Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Private Attributes
multiprocessing.queues.JoinableQueue Class Reference
Inheritance diagram for multiprocessing.queues.JoinableQueue:
Inheritance graph
[legend]
Collaboration diagram for multiprocessing.queues.JoinableQueue:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def __getstate__
def __setstate__
def put
def task_done
def join
def get
def qsize
def empty
def full
def get_nowait
def put_nowait
def close
def join_thread
def cancel_join_thread

Public Attributes

_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Private Attributes

 _unfinished_tasks
 _cond

Detailed Description

Definition at line 297 of file queues.py.


Constructor & Destructor Documentation

def multiprocessing.queues.JoinableQueue.__init__ (   self,
  maxsize = 0 
)

Reimplemented from multiprocessing.queues.Queue.

Definition at line 299 of file queues.py.

00299 
00300     def __init__(self, maxsize=0):
00301         Queue.__init__(self, maxsize)
00302         self._unfinished_tasks = Semaphore(0)
00303         self._cond = Condition()

Here is the caller graph for this function:


Member Function Documentation

Reimplemented from multiprocessing.queues.Queue.

Definition at line 304 of file queues.py.

00304 
00305     def __getstate__(self):
00306         return Queue.__getstate__(self) + (self._cond, self._unfinished_tasks)

Reimplemented from multiprocessing.queues.Queue.

Definition at line 307 of file queues.py.

00307 
00308     def __setstate__(self, state):
00309         Queue.__setstate__(self, state[:-2])
00310         self._cond, self._unfinished_tasks = state[-2:]

Definition at line 165 of file queues.py.

00165 
00166     def cancel_join_thread(self):
00167         debug('Queue.cancel_join_thread()')
00168         self._joincancelled = True
00169         try:
00170             self._jointhread.cancel()
00171         except AttributeError:
00172             pass

def multiprocessing.queues.Queue.close (   self) [inherited]

Definition at line 153 of file queues.py.

00153 
00154     def close(self):
00155         self._closed = True
00156         self._reader.close()
00157         if self._close:
00158             self._close()

Here is the caller graph for this function:

def multiprocessing.queues.Queue.empty (   self) [inherited]

Definition at line 141 of file queues.py.

00141 
00142     def empty(self):
00143         return not self._poll()

def multiprocessing.queues.Queue.full (   self) [inherited]

Definition at line 144 of file queues.py.

00144 
00145     def full(self):
00146         return self._sem._semlock._is_zero()

def multiprocessing.queues.Queue.get (   self,
  block = True,
  timeout = None 
) [inherited]

Definition at line 113 of file queues.py.

00113 
00114     def get(self, block=True, timeout=None):
00115         if block and timeout is None:
00116             self._rlock.acquire()
00117             try:
00118                 res = self._recv()
00119                 self._sem.release()
00120                 return res
00121             finally:
00122                 self._rlock.release()
00123 
00124         else:
00125             if block:
00126                 deadline = time.time() + timeout
00127             if not self._rlock.acquire(block, timeout):
00128                 raise Empty
00129             try:
00130                 if not self._poll(block and (deadline-time.time()) or 0.0):
00131                     raise Empty
00132                 res = self._recv()
00133                 self._sem.release()
00134                 return res
00135             finally:
00136                 self._rlock.release()

Here is the caller graph for this function:

def multiprocessing.queues.Queue.get_nowait (   self) [inherited]

Definition at line 147 of file queues.py.

00147 
00148     def get_nowait(self):
00149         return self.get(False)

Here is the call graph for this function:

Definition at line 338 of file queues.py.

00338 
00339     def join(self):
00340         self._cond.acquire()
00341         try:
00342             if not self._unfinished_tasks._semlock._is_zero():
00343                 self._cond.wait()
00344         finally:
00345             self._cond.release()
00346 
00347 #
00348 # Simplified Queue type -- really just a locked pipe
00349 #

Here is the caller graph for this function:

def multiprocessing.queues.Queue.join_thread (   self) [inherited]

Definition at line 159 of file queues.py.

00159 
00160     def join_thread(self):
00161         debug('Queue.join_thread()')
00162         assert self._closed
00163         if self._jointhread:
00164             self._jointhread()

def multiprocessing.queues.JoinableQueue.put (   self,
  obj,
  block = True,
  timeout = None 
)

Reimplemented from multiprocessing.queues.Queue.

Definition at line 311 of file queues.py.

00311 
00312     def put(self, obj, block=True, timeout=None):
00313         assert not self._closed
00314         if not self._sem.acquire(block, timeout):
00315             raise Full
00316 
00317         self._notempty.acquire()
00318         self._cond.acquire()
00319         try:
00320             if self._thread is None:
00321                 self._start_thread()
00322             self._buffer.append(obj)
00323             self._unfinished_tasks.release()
00324             self._notempty.notify()
00325         finally:
00326             self._cond.release()
00327             self._notempty.release()

Here is the call graph for this function:

Here is the caller graph for this function:

def multiprocessing.queues.Queue.put_nowait (   self,
  obj 
) [inherited]

Definition at line 150 of file queues.py.

00150 
00151     def put_nowait(self, obj):
00152         return self.put(obj, False)

Here is the call graph for this function:

def multiprocessing.queues.Queue.qsize (   self) [inherited]

Definition at line 137 of file queues.py.

00137 
00138     def qsize(self):
00139         # Raises NotImplementedError on Mac OSX because of broken sem_getvalue()
00140         return self._maxsize - self._sem._semlock._get_value()

Definition at line 328 of file queues.py.

00328 
00329     def task_done(self):
00330         self._cond.acquire()
00331         try:
00332             if not self._unfinished_tasks.acquire(False):
00333                 raise ValueError('task_done() called too many times')
00334             if self._unfinished_tasks._semlock._is_zero():
00335                 self._cond.notify_all()
00336         finally:
00337             self._cond.release()


Member Data Documentation

Definition at line 302 of file queues.py.

Definition at line 301 of file queues.py.

Definition at line 107 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.


The documentation for this class was generated from the following file: