MCPcopy Index your code
hub / github.com/coder/coder / syncStepCounter

Function syncStepCounter

coderd/x/chatd/chatdebug/recorder.go:171–186  ·  view source on GitHub ↗
(runID uuid.UUID, stepNumber int32)

Source from the content-addressed store, hash-verified

169}
170
171func syncStepCounter(runID uuid.UUID, stepNumber int32) {
172 val, _ := stepCounters.LoadOrStore(runID, &atomic.Int32{})
173 counter, ok := val.(*atomic.Int32)
174 if !ok {
175 panic("chatdebug: invalid step counter type")
176 }
177 for {
178 current := counter.Load()
179 if current >= stepNumber {
180 return
181 }
182 if counter.CompareAndSwap(current, stepNumber) {
183 return
184 }
185 }
186}
187
188type stepHandle struct {
189 stepCtx *StepContext

Callers 2

beginStepFunction · 0.85

Calls 3

LoadOrStoreMethod · 0.80
CompareAndSwapMethod · 0.80
LoadMethod · 0.45

Tested by 1