NAME

src/pmc/tqueue.pmc - Threadsafe Queue

DESCRIPTION

Threadsafe queue class for inter thread communication. If you have an unthreaded program then please use an Array-like PMC.

     new P0, 'TQueue'
     push P0, some
     new P2, 'ParrotThread'
     ...

and in other thread (at least, when shared PMCs work :)

     shift P1, P0

Note: The TQueue must always be emptied before program exit.

Methods

void init()
Initializes the queue.
PMC *clone()
Returns the queue itself. No copy is made.
void mark()
Marks all the threads in the queue as live.
void destroy()
Destroys the queue.
INTVAL defined()
Returns whether there are any threads in the queue.
INTVAL get_integer()
INTVAL elements()
Returns the number of threads in the queue.
void push_pmc(PMC *item)
Adds the thread *item to the end of the queue.
PMC *shift_pmc()
Removes the first thread from the start of the queue.