MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / worker

Method worker

pkg/utilds/workqueue.go:39–58  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

37}
38
39func (wq *WorkQueue[T]) worker() {
40 defer wq.wg.Done()
41 for {
42 wq.lock.Lock()
43 for len(wq.queue) == 0 && !wq.closed {
44 wq.cond.Wait()
45 }
46
47 if wq.closed && len(wq.queue) == 0 {
48 wq.lock.Unlock()
49 return
50 }
51
52 item := wq.queue[0]
53 wq.queue = wq.queue[1:]
54 wq.lock.Unlock()
55
56 wq.workFn(item)
57 }
58}
59
60func (wq *WorkQueue[T]) Close(immediate bool) {
61 wq.lock.Lock()

Callers 1

EnqueueMethod · 0.95

Calls 1

WaitMethod · 0.65

Tested by

no test coverage detected