%PDF- %PDF-
| Direktori : /proc/self/root/proc/3522530/root/lib64/python2.7/site-packages/zmq/devices/ |
| Current File : //proc/self/root/proc/3522530/root/lib64/python2.7/site-packages/zmq/devices/basedevice.pyo |
�
+�{Wc @ s� d Z d d l Z d d l m Z d d l m Z d d l m Z m Z m Z m
Z
m Z d d d � � YZ d e f d � � YZ
d
e
f d � � YZ d e
f d
� � YZ d d
d g Z d S( s2 Classes for running 0MQ Devices in the background.i����N( t Thread( t Process( t devicet QUEUEt Contextt ETERMt ZMQErrort Devicec B s� e Z d Z e j Z e d
d
d � Z d � Z d � Z
d � Z d � Z d � Z
d � Z d � Z d � Z d
� Z d � Z d
d � Z RS( sc A 0MQ Device to be run in the background.
You do not pass Socket instances to this, but rather Socket types::
Device(device_type, in_socket_type, out_socket_type)
For instance::
dev = Device(zmq.QUEUE, zmq.DEALER, zmq.ROUTER)
Similar to zmq.device, but socket types instead of sockets themselves are
passed, and the sockets are created in the work thread, to avoid issues
with thread safety. As a result, additional bind_{in|out} and
connect_{in|out} methods and setsockopt_{in|out} allow users to specify
connections for the sockets.
Parameters
----------
device_type : int
The 0MQ Device type
{in|out}_type : int
zmq socket types, to be passed later to context.socket(). e.g.
zmq.PUB, zmq.SUB, zmq.REQ. If out_type is < 0, then in_socket is used
for both in_socket and out_socket.
Methods
-------
bind_{in_out}(iface)
passthrough for ``{in|out}_socket.bind(iface)``, to be called in the thread
connect_{in_out}(iface)
passthrough for ``{in|out}_socket.connect(iface)``, to be called in the
thread
setsockopt_{in_out}(opt,value)
passthrough for ``{in|out}_socket.setsockopt(opt, value)``, to be called in
the thread
Attributes
----------
daemon : int
sets whether the thread should be run as a daemon
Default is true, because if it is false, the thread will not
exit unless it is killed
context_factory : callable (class attribute)
Function for creating the Context. This will be Context.instance
in ThreadDevices, and Context in ProcessDevices. The only reason
it is not instance() in ProcessDevices is that there may be a stale
Context instance already initialized, and the forked environment
should *never* try to use it.
c C s� | | _ | d k r$ t d � � n | d k r? t d � � n | | _ | | _ g | _ g | _ g | _ g | _ g | _ g | _
t | _ t
| _ d S( Ns in_type must be specifieds out_type must be specified( t device_typet Nonet TypeErrort in_typet out_typet _in_bindst _in_connectst _in_sockoptst
_out_bindst
_out_connectst
_out_sockoptst Truet daemont Falset done( t selfR R R ( ( s<