Пример #1
0
 def new_actor(self, actor_type, name):
     actor_queue = mp.Queue()
     self.actors[name] = actor_queue
     actor_ps = mp.Process(target=actor_process,
                           args=(actor_type, actor_queue, self.queue))
     actor_ps.start()
     return actor_ps
Пример #2
0
 def new_actor(self, actor_type, weak_ref, args, kwargs):
     actor_queue = mp.Queue()
     self.actors[weak_ref._thtr_actor_key] = actor_queue
     event = self.manager.Event()  # TODO: self.manager?.Event()
     actor_ps = mp.Process(target=director.actor_process,
                           args=(actor_type, weak_ref,
                                 actor_queue, self.actors, event,
                                 args, kwargs))
     actor_ps.start()
     # we need to wait for the child to be working,
     # otherwise, the queue loses events
     event.wait()
     return actor_ps
Пример #3
0
 def __init__(self):
     self.actors = {}
     self.queue = mp.Queue()