Method: Polyphony::Queue#cap
- Defined in:
- ext/polyphony/queue.c
#cap(cap) ⇒ Queue
Sets the capacity for the queue to the given value. If 0 or nil is given, the queue becomes uncapped.
266 267 268 269 270 271 272 273 274 275 276 277 278 |
# File 'ext/polyphony/queue.c', line 266
VALUE Queue_cap(VALUE self, VALUE cap) {
unsigned int new_capacity = NUM2UINT(cap);
Queue_t *queue;
GetQueue(self, queue);
queue->capacity = new_capacity;
if (queue->capacity)
queue_schedule_blocked_fibers_to_capacity(queue);
else
queue_schedule_all_blocked_fibers(&queue->push_queue);
return self;
}
|