home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  

Book HomeJava and XSLTSearch this book

8.211. Thread::Queue

Provides a thread-safe queue. Any number of threads can add elements to the end of the queue or remove elements from the head.


$q = new Thread::Queue

Creates a new empty queue. Returns an object representing the queue.



Removes and returns a scalar from the head of the queue. If the queue is empty, dequeue blocks the thread until another thread enqueue s a scalar on the queue.



Like dequeue, but returns undef if the queue is empty instead of blocking.


$q->enqueue list

Adds the list of scalars, list, to the end of the queue.



Returns the number of items remaining in the queue.

Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.