Class Thread::Apartment::Common
- Known Subclasses:
- Thread::Apartment::Server
- Thread::Apartment::Client
Provides common marshalling/unmarshalling methods, and common
exported constants.
Licensed under the Academic Free License version 2.1, as specified in the
License.txt file included in this software package, or at
OpenSource.org.
- Author:
- D. Arnold
- Version:
- 0.50
- Since:
- 2005-12-01
Unless otherwise noted, $self
 is the object instance variable.
| Exported Symbols | 
|---|
| TA_SIMPLEX | flag indicating a method/closure is simplex (i.e., does not return results) | 
| TA_URGENT | flag indicating a method/closure is urgent (i.e., should be posted to the head of the proxied object's TQD) | 
| TA_NO_OBJECTS | flag indicating a method does not return objects. Used by
Thread::Apartment::Server objects
to optimize the marhsalling of returned method results. | 
| Method Summary | 
|---|
| marshal(@params)Marshall input parameters into a TQD-compatible format
 | 
| unmarshal($result)Unmarshall the contents of the arrayref previsouly marshalled via
marshal()
 | 
marshal
marshal(@params)
- Marshall input parameters into a TQD-compatible format.
Each parameter is converted to a 2-tuple of a class descriptor
string (undef for simple scalar parameters), and the marshalled
version of the parameter. Marshalling rules are:
 
- Scalars and threads::shared values are marshalled as is.
- non-threads::shared references to scalars, arrays, or hashes, or
objects which do not implement Thread::Queue::Queueable
are marshalled via Storable
- closures are converted to Thread::Apartment::Closure objects.
- Thread::Apartment::Server objects are marshalled using their TAC's
- Thread::Queue::Queueable
objects are marshalled using their onEnqueue()/curse() methods.
 
NOTE: Passing of GLOBs or other I/O objects is not currently supported; applications
are responsible for implementing TQQ to curse() them into their fileno, and redeem() them
via an fdopen() operation in the receiving thread.
 
 
- 
- Parameters:
- @params- parameters/results to be marshalled
- Returns:
- threads::shared arrayref of marshalled parameters
 
unmarshal
unmarshal($result)
- Unmarshall the contents of the arrayref previsouly marshalled via
marshal(). input parameters into a TQD-compatible format.
Each parameter is retrieved from the 2-tuple (class descriptor, marshalled value).
Unmarshalling rules are:
 
 
- If the class descriptor is undef, the marshalled value is used as is
- if the class descriptor is 'Storable', Storable::thaw() is used to recover the
parameter value
- if the marshalled value is threads::shared, the object is simply reblessed into the class
- all other classes are assumed to be
Thread::Queue::Queueable,
and the class's redeem() method is called to recover the object.
 
 
- 
- Parameters:
- $result- arrayref of marshalled parameters/results
- Returns:
- arrayref of unmarshalled parameters
 
Generated by psichedoc on Mon Mar 27 08:51:36 2006