Method: Polyphony::Queue#shift
- Defined in:
- ext/polyphony/queue.c
#shift ⇒ any #shift(true) ⇒ any #pop ⇒ any #pop(true) ⇒ any #deq ⇒ any #deq(true) ⇒ any
Removes the first value in the queue and returns it. If the optional nonblock parameter is true, the operation is non-blocking. In non-blocking mode, if the queue is empty, a ThreadError exception is raised. In blocking mode, if the queue is empty, the call will block until an item is added to the queue.
232 233 234 235 236 237 238 239 240 |
# File 'ext/polyphony/queue.c', line 232 VALUE Queue_shift(int argc,VALUE *argv, VALUE self) { int nonblock = argc && RTEST(argv[0]); Queue_t *queue; GetQueue(self, queue); return nonblock ? Queue_shift_nonblock(queue) : Queue_shift_block(queue); } |