1 | function ThreadNextTick
|
2 | function next-tick (cb)
|
3 | thread._ntq.push cb
|
4 | return this
|
5 | function dispatch-next-ticks (l, p, err, _ntq)
|
6 | if l = (_ntq = thread._ntq).length
|
7 | p = err = 0
|
8 | try
|
9 | while true
|
10 | _ntq[p]!
|
11 | break unless ++p < l
|
12 | catch e
|
13 | thread._ntq = _ntq.slice ++p
|
14 | throw e
|
15 | return (thread._ntq = _ntq.slice p).length
|
16 | return 0
|
17 | thread._ntq = []
|
18 | thread.next-tick = next-tick
|
19 | return dispatch-next-ticks
|