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

Method Wait

util/execqueue/execqueue.go:100–127  ·  view source on GitHub ↗

Wait waits for the queue to be empty or shut down.

(ctx context.Context)

Source from the content-addressed store, hash-verified

98
99// Wait waits for the queue to be empty or shut down.
100func (q *ExecQueue) Wait(ctx context.Context) error {
101 q.mu.Lock()
102 q.initCtxLocked()
103 waitCh := q.doneWaiter
104 if q.inFlight && waitCh == nil {
105 waitCh = make(chan struct{})
106 q.doneWaiter = waitCh
107 }
108 closed := q.closed
109 shutdownCtx := q.ctx
110 q.mu.Unlock()
111
112 if closed {
113 return errExecQueueShutdown
114 }
115 if waitCh == nil {
116 return nil
117 }
118
119 select {
120 case <-waitCh:
121 return nil
122 case <-shutdownCtx.Done():
123 return errExecQueueShutdown
124 case <-ctx.Done():
125 return ctx.Err()
126 }
127}

Callers 1

TestExecQueueFunction · 0.95

Calls 5

initCtxLockedMethod · 0.95
LockMethod · 0.65
UnlockMethod · 0.65
DoneMethod · 0.65
ErrMethod · 0.45

Tested by 1

TestExecQueueFunction · 0.76