Thread-safe queue module, using locks.
create maxsize returns a synchronized queue bounded to have no more than
Blocks until there's room on the queue, then pushes.
Does not block, may grow the queue past maxsize
Pushes an event on the queue if the queue is less than maxsize, otherwise drops it. Returns true if the push was successful
returns the number of elements in the queue.
pops an element off the queue, blocking until something is * available
returns the element popped and the length of the queue after * this element was popped.
clears the queue
wait_not_empty sq Waits for something to be available. This is
useful if you want to wait, but not take something out. This
function is not useful in most cases, but in some complex cases it
is essential. For example, if you need to take another lock before
you remove something from the queue for processing, you might
want to try to take that other lock, and if it fails do something
This function is not dangerous, there is just ONE thing you HAVE to remember if you use it. Just because this function returns doesn't mean that pop will succeed, someone might have gotten there first, so you have to use transfer_queue_nowait if you don't want to block.