length (SizedQueue)

    /*
     * Document-method: length
     * call-seq: length
     *
     * Returns the length of the queue.
     *
     */

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

        lock_mutex(&queue->mutex);
        result = ULONG2NUM(queue->values.size);
        unlock_mutex(&queue->mutex);

        return result;
    }