ACC SHELL
Path : /usr/lib/python/ |
|
Current File : //usr/lib/python/Queue.pyc |
Ñò
nÄMc @ s¶ d Z d d k l Z d d k l Z d d k Z d d d d d g Z d e f d
„ ƒ YZ d e f d „ ƒ YZ d d d „ ƒ YZ
d e
f d
„ ƒ YZ d e
f d „ ƒ YZ d S( s' A multi-producer, multi-consumer queue.iÿÿÿÿ( t time( t dequeNt Emptyt Fullt Queuet
PriorityQueuet LifoQueuec B s e Z d Z RS( s4 Exception raised by Queue.get(block=0)/get_nowait().( t __name__t
__module__t __doc__( ( ( s /usr/lib/python2.6/Queue.pyR s c B s e Z d Z RS( s4 Exception raised by Queue.put(block=0)/put_nowait().( R R R ( ( ( s /usr/lib/python2.6/Queue.pyR
s c B sž e Z d Z d d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z e d d „ Z d „ Z e d d
„ Z
d „ Z d „ Z e d
„ Z d „ Z d „ Z RS( sj Create a queue object with a given maximum size.
If maxsize is <= 0, the queue size is infinite.
i c C s£ y d d k } Wn t j
o d d k } n X| | _ | i | ƒ | i ƒ | _ | i | i ƒ | _ | i | i ƒ | _ | i | i ƒ | _
d | _ d S( Niÿÿÿÿi ( t threadingt ImportErrort dummy_threadingt maxsizet _initt Lockt mutext Conditiont not_emptyt not_fullt all_tasks_donet unfinished_tasks( t selfR
R
( ( s /usr/lib/python2.6/Queue.pyt __init__ s
c C sw | i i ƒ zU | i d } | d j o. | d j o t d ƒ ‚ n | i i ƒ n | | _ Wd | i i ƒ Xd S( s. Indicate that a formerly enqueued task is complete.
Used by Queue consumer threads. For each get() used to fetch a task,
a subsequent call to task_done() tells the queue that the processing
on the task is complete.
If a join() is currently blocking, it will resume when all items
have been processed (meaning that a task_done() call was received
for every item that had been put() into the queue).
Raises a ValueError if called more times than there were items
placed in the queue.
i i s! task_done() called too many timesN( R t acquireR t
ValueErrort
notify_allt release( R t
unfinished( ( s /usr/lib/python2.6/Queue.pyt task_done- s
c C sE | i i ƒ z# x | i o | i i ƒ q WWd | i i ƒ Xd S( sƒ Blocks until all items in the Queue have been gotten and processed.
The count of unfinished tasks goes up whenever an item is added to the
queue. The count goes down whenever a consumer thread calls task_done()
to indicate the item was retrieved and all work on it is complete.
When the count of unfinished tasks drops to zero, join() unblocks.
N( R R R t waitR ( R ( ( s /usr/lib/python2.6/Queue.pyt joinF s
c C s* | i i ƒ | i ƒ } | i i ƒ | S( s9 Return the approximate size of the queue (not reliable!).( R R t _qsizeR ( R t n( ( s /usr/lib/python2.6/Queue.pyt qsizeV s
c C s+ | i i ƒ | i ƒ } | i i ƒ | S( sC Return True if the queue is empty, False otherwise (not reliable!).( R R R R ( R R! ( ( s /usr/lib/python2.6/Queue.pyt empty] s
c C sD | i i ƒ d | i j o | i ƒ j n } | i i ƒ | S( sB Return True if the queue is full, False otherwise (not reliable!).i ( R R R
R R ( R R! ( ( s /usr/lib/python2.6/Queue.pyt fulld s
&
c C sF | i i ƒ z$| i d j oç | p$ | i ƒ | i j o
t ‚ qq| d j o/ x¨ | i ƒ | i j o | i i ƒ q[ Wq| d j o t d ƒ ‚ qt ƒ | } xS | i ƒ | i j o8 | t ƒ } | d j o
t ‚ n | i i | ƒ q´ Wn | i | ƒ | i
d 7_
| i i ƒ Wd | i i
ƒ Xd S( s Put an item into the queue.
If optional args 'block' is true and 'timeout' is None (the default),
block if necessary until a free slot is available. If 'timeout' is
a positive number, it blocks at most 'timeout' seconds and raises
the Full exception if no free slot was available within that time.
Otherwise ('block' is false), put an item on the queue if a free slot
is immediately available, else raise the Full exception ('timeout'
is ignored in that case).
i s# 'timeout' must be a positive numberg i N( R R R
R R t NoneR R t _timet _putR R t notifyR ( R t itemt blockt timeoutt endtimet remaining( ( s /usr/lib/python2.6/Queue.pyt putk s.
c C s | i | t ƒ S( s© Put an item into the queue without blocking.
Only enqueue the item if a free slot is immediately available.
Otherwise raise the Full exception.
( R. t False( R R) ( ( s /usr/lib/python2.6/Queue.pyt
put_nowaitŽ s c C s | i i ƒ zé | p | i ƒ p
t ‚ qØ n§ | d j o&