MCPcopy Create free account
hub / github.com/erpc/erpc / updateUpdatedAtMs

Method updateUpdatedAtMs

data/shared_state_variable.go:66–76  ·  view source on GitHub ↗

updateUpdatedAtMs atomically advances updatedAtUnixMs if newUpdatedAt is newer. Returns true if updatedAtUnixMs was advanced.

(newUpdatedAt int64)

Source from the content-addressed store, hash-verified

64// updateUpdatedAtMs atomically advances updatedAtUnixMs if newUpdatedAt is newer.
65// Returns true if updatedAtUnixMs was advanced.
66func (v *baseSharedVariable) updateUpdatedAtMs(newUpdatedAt int64) bool {
67 for {
68 current := v.updatedAtUnixMs.Load()
69 if newUpdatedAt <= current {
70 return false
71 }
72 if v.updatedAtUnixMs.CompareAndSwap(current, newUpdatedAt) {
73 return true
74 }
75 }
76}
77
78// advanceTimestampPast advances updatedAtUnixMs to be strictly greater than remoteTs.
79// Uses current wall clock if it's newer, otherwise uses remoteTs + 1.

Callers 1

processNewStateMethod · 0.80

Calls 1

LoadMethod · 0.80

Tested by

no test coverage detected