Lines Matching refs:wq
71 func (wq *WorkQueue) enqueue(item interface{}) {
72 wq.mu.Lock()
73 defer wq.mu.Unlock()
77 wq.triageCandidate = append(wq.triageCandidate, item)
79 wq.triage = append(wq.triage, item)
82 wq.candidate = append(wq.candidate, item)
84 wq.smash = append(wq.smash, item)
90 func (wq *WorkQueue) dequeue() (item interface{}) {
91 wq.mu.RLock()
92 if len(wq.triageCandidate)+len(wq.candidate)+len(wq.triage)+len(wq.smash) == 0 {
93 wq.mu.RUnlock()
96 wq.mu.RUnlock()
97 wq.mu.Lock()
99 if len(wq.triageCandidate) != 0 {
100 last := len(wq.triageCandidate) - 1
101 item = wq.triageCandidate[last]
102 wq.triageCandidate = wq.triageCandidate[:last]
103 } else if len(wq.candidate) != 0 {
104 last := len(wq.candidate) - 1
105 item = wq.candidate[last]
106 wq.candidate = wq.candidate[:last]
107 wantCandidates = len(wq.candidate) < wq.procs
108 } else if len(wq.triage) != 0 {
109 last := len(wq.triage) - 1
110 item = wq.triage[last]
111 wq.triage = wq.triage[:last]
112 } else if len(wq.smash) != 0 {
113 last := len(wq.smash) - 1
114 item = wq.smash[last]
115 wq.smash = wq.smash[:last]
117 wq.mu.Unlock()
120 case wq.needCandidates <- struct{}{}:
127 func (wq *WorkQueue) wantCandidates() bool {
128 wq.mu.RLock()
129 defer wq.mu.RUnlock()
130 return len(wq.candidate) < wq.procs