MCPcopy Index your code
hub / github.com/tailscale/tailscale / Add

Method Add

util/execqueue/execqueue.go:24–37  ·  view source on GitHub ↗
(f func())

Source from the content-addressed store, hash-verified

22}
23
24func (q *ExecQueue) Add(f func()) {
25 q.mu.Lock()
26 defer q.mu.Unlock()
27 if q.closed {
28 return
29 }
30 q.initCtxLocked()
31 if q.inFlight {
32 q.queue = append(q.queue, f)
33 } else {
34 q.inFlight = true
35 go q.run(f)
36 }
37}
38
39// RunSync waits for the queue to be drained and then synchronously runs f.
40// It returns an error if the queue is closed before f is run or ctx expires.

Callers 2

RunSyncMethod · 0.95
TestExecQueueFunction · 0.95

Calls 4

initCtxLockedMethod · 0.95
runMethod · 0.95
LockMethod · 0.65
UnlockMethod · 0.65

Tested by 1

TestExecQueueFunction · 0.76