1 # -*- encoding: binary -*-
3 module Rainbows::WorkerYield
5 # Sleep if we're busy (and let other threads run). Another less busy
6 # worker process may take it for us if we sleep. This is gross but
7 # other options still suck because they require expensive/complicated
8 # synchronization primitives for _every_ case, not just this unlikely
9 # one. Since this case is (or should be) uncommon, just busy wait
10 # when we have to. We don't use Thread.pass because it needlessly
11 # spins the CPU during I/O wait, CPU cycles that can be better used by
12 # other worker _processes_.