Package gyropy :: Module g_mailbox :: Class waitbox
[frames] | no frames]

Class waitbox

source code


This is a stripped down mailbox that is good for one message between one sender and one reciever. It is an error to call put() or get() or putclose() more than once.

The normal usage is that you create the mailbox, spawn a thread, and hand the mailbox to the new thread. Then, one side calls get on the mailbox to wait for an answer. The other side computes something, then calls put. The waitbox is then thrown away.

Instance Methods
 
__init__(self)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
__nonzero__(self) source code
 
putclose(self, to_be_raised=EOF())
Close the connection.
source code
 
put(self, v) source code
 
get(self)
Get an object from the mailbox.
source code
 
__del__(self) source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

__init__(self)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

putclose(self, to_be_raised=EOF())

source code 

Close the connection. This is normally called by the producer of data in place of put(). It causes other threads to raise an exception.

get(self)

source code 

Get an object from the mailbox. This will normally block if the mailbox is empty.

Notes:
  • Suicide has a lower priority than processing data. So, if there is data in the mailbox and putclose() has been called, one call to get() will succeed; the second call will raise an exception.
  • If the mailbox is empty, and if a previous call has specified an exception to be raised by readers, raise it.