Home | History | Annotate | Download | only in runtime

Lines Matching refs:tb

19 	tb *timersBucket // the bucket the timer lives in
58 t.tb = &timers[id].timersBucket
59 return t.tb
99 tb := t.assignBucket()
100 lock(&tb.lock)
101 tb.addtimerLocked(t)
102 goparkunlock(&tb.lock, "sleep", traceEvGoSleep, 2)
129 tb := t.assignBucket()
130 lock(&tb.lock)
131 tb.addtimerLocked(t)
132 unlock(&tb.lock)
138 func (tb *timersBucket) addtimerLocked(t *timer) {
144 t.i = len(tb.t)
145 tb.t = append(tb.t, t)
146 siftupTimer(tb.t, t.i)
149 if tb.sleeping {
150 tb.sleeping = false
151 notewakeup(&tb.waitnote)
153 if tb.rescheduling {
154 tb.rescheduling = false
155 goready(tb.gp, 0)
158 if !tb.created {
159 tb.created = true
160 go timerproc(tb)
167 if t.tb == nil {
168 // t.tb can be nil if the user created a timer
176 tb := t.tb
178 lock(&tb.lock)
183 last := len(tb.t) - 1
184 if i < 0 || i > last || tb.t[i] != t {
185 unlock(&tb.lock)
189 tb.t[i] = tb.t[last]
190 tb.t[i].i = i
192 tb.t[last] = nil
193 tb.t = tb.t[:last]
195 siftupTimer(tb.t, i)
196 siftdownTimer(tb.t, i)
198 unlock(&tb.lock)
203 // It sleeps until the next event in the tb heap.
205 func timerproc(tb *timersBucket) {
206 tb.gp = getg()
208 lock(&tb.lock)
209 tb.sleeping = false
213 if len(tb.t) == 0 {
217 t := tb.t[0]
225 siftdownTimer(tb.t, 0)
228 last := len(tb.t) - 1
230 tb.t[0] = tb.t[last]
231 tb.t[0].i = 0
233 tb.t[last] = nil
234 tb.t = tb.t[:last]
236 siftdownTimer(tb.t, 0)
243 unlock(&tb.lock)
248 lock(&tb.lock)
252 tb.rescheduling = true
253 goparkunlock(&tb.lock, "timer goroutine (idle)", traceEvGoBlock, 1)
257 tb.sleeping = true
258 tb.sleepUntil = now + delta
259 noteclear(&tb.waitnote)
260 unlock(&tb.lock)
261 notetsleepg(&tb.waitnote, delta)
285 tb := &timers[i]
286 if !tb.created || len(tb.t) == 0 {
289 t := tb.t[0]
299 tb := minT.tb
300 if !tb.rescheduling {
303 tb.rescheduling = false
304 return tb.gp
316 tb := &timers[i]
318 lock(&tb.lock)
319 if tb.sleeping && tb.sleepUntil < next {
320 next = tb.sleepUntil
322 unlock(&tb.lock)