Module parley.controllers.thread

Classes

class ThreadActor(parley.actor.AbstractActor):

QueueClass = <class parley.controllers.thread.ThreadQueue>

name = <property object>

def _check_for_signals(self):
Check if any signals are waiting in the signal queue.

Overrides: parley.actor.AbstractActor

def _get_name(self):
def _handle_signal(self, signal):
Handle a received signal.

Depending on the value of self.trap_exceptions, we either
raise the signal as an exception or place it in the message queue.

Overrides: parley.actor.AbstractActor

def _next_message(self, msg_filter, wait):

Overrides: parley.actor.AbstractActor

def _set_name(self, name):
def get_msg(self):
Remove one message from the queue,
blocking if none are available.

Overrides: parley.actor.AbstractActor

def get_msg_nowait(self):
Remove one message from the queue if one exists,
otherwise return None.

Overrides: parley.actor.AbstractActor

def go(self):

Overrides: parley.actor.AbstractActor

def put_msg(self, msg):
Deliver the given message to this actor.

Overrides: parley.actor.AbstractActor

def put_signal(self, msg):

Overrides: parley.actor.AbstractActor

def recv(self, msg_filter=None, wait=True):

Overrides: parley.actor.AbstractActor

def register_id(self):

Overrides: parley.actor.AbstractActor

def run(self):
Hand off control to self.target.

This function will be spawned in a new frame of execution.

Overrides: parley.actor.AbstractActor

def schedule(self):
Check for signals and ask the controller
to yield control of execution.

Overrides: parley.actor.AbstractActor

class ThreadController(parley.controller.AbstractController):

ActorClass = <class 'parley.controllers.thread.ThreadActor'>

def _create_link(self, a, b):

Overrides: parley.controller.AbstractController

def _current_actor(self):

Overrides: parley.controller.AbstractController

def _current_actor_id(self):

Overrides: parley.controller.AbstractController

def _current_actor_proxy(self):

Overrides: parley.controller.AbstractController

def _quit(self, actor_id):

Overrides: parley.controller.AbstractController

def _remove_link(self, a, b):

Overrides: parley.controller.AbstractController

def _spawn(self, target, args, kwargs, link=False):

Overrides: parley.controller.AbstractController

def alert_exception(self, origin_id, e):

Overrides: parley.controller.AbstractController

def alert_quit(self, origin_id):

Overrides: parley.controller.AbstractController

def link(self, target):

Overrides: parley.controller.AbstractController

def lookup(self, name):

Overrides: parley.controller.AbstractController

def register(self, actor_proxy, name):

Overrides: parley.controller.AbstractController

def schedule(self):
Yield control of execution.

Cooperatively scheduled execution models
will have to override this function.

Overrides: parley.controller.AbstractController

def send(self, target_id, msg):

Overrides: parley.controller.AbstractController

def send_signal(self, target_id, msg):

Overrides: parley.controller.AbstractController

def shutdown(self):
Send quit signals to every actor and attempt to shut down
the node.

This function is called when any actor raises SystemExit. It
does not attempt to force actors to shut down: if an actor
does not call recv(), or if it is trapping signals and not
handling them properly, it will not shut down.

Overrides: parley.controller.AbstractController

def spawn(self, target, *args, **kwargs):

Overrides: parley.controller.AbstractController

def spawn_link(self, target, *args, **kwargs):

Overrides: parley.controller.AbstractController

def unlink(self, target):

Overrides: parley.controller.AbstractController

def unregister(self, name):

Overrides: parley.controller.AbstractController

class ThreadQueue(Queue.Queue):
def _empty(self):

Overrides: Queue.Queue

def _full(self):

Overrides: Queue.Queue

def _get(self):

Overrides: Queue.Queue

def _init(self, maxsize):

Overrides: Queue.Queue

def _put(self, item):

Overrides: Queue.Queue

def _qsize(self):

Overrides: Queue.Queue

def empty(self):
Return True if the queue is empty, False otherwise (not reliable!).

Overrides: Queue.Queue

def full(self):
Return True if the queue is full, False otherwise (not reliable!).

Overrides: Queue.Queue

def get(self, block=True, timeout=None):
Remove and return an item from the queue.

If optional args 'block' is true and 'timeout' is None (the default),
block if necessary until an item is available. If 'timeout' is
a positive number, it blocks at most 'timeout' seconds and raises
the Empty exception if no item was available within that time.
Otherwise ('block' is false), return an item if one is immediately
available, else raise the Empty exception ('timeout' is ignored
in that case).

Overrides: Queue.Queue

def get_nowait(self):

Overrides: Queue.Queue

def put(self, item, block=True, timeout=None):
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).

Overrides: Queue.Queue

def put_nowait(self, item):
Put an item into the queue without blocking.

Only enqueue the item if a free slot is immediately available.
Otherwise raise the Full exception.

Overrides: Queue.Queue

def qsize(self):
Return the approximate size of the queue (not reliable!).

Overrides: Queue.Queue