num_waiting (Queue)

    /*
     * Document-method: num_waiting
     * call-seq: num_waiting
     *
     * Returns the number of threads waiting on the queue.
     *
     */

    static VALUE
    rb_queue_num_waiting(VALUE self)
    {
        Queue *queue;
        VALUE result;
        Data_Get_Struct(self, Queue, queue);

        lock_mutex(&queue->mutex);
        result = ULONG2NUM(queue->value_available.waiting.size +
          queue->space_available.waiting.size);
        unlock_mutex(&queue->mutex);

        return result;
    }