Ejemplo n.º 1
0
 def __init__(self, func, *args, thrname="", daemon=True):
     super().__init__(None, self.run, thrname, (), {}, daemon=daemon)
     self.name = thrname or obj.getname(func)
     self.result = None
     self.queue = queue.Queue()
     self.queue.put_nowait((func, args))
     self.sleep = 0
Ejemplo n.º 2
0
def flt(event):
    try:
        index = int(event.args[0])
        event.reply(fmt(Bus.objs[index], skip=["queue", "ready", "iqueue"]))
        return
    except (TypeError, IndexError):
        pass
    event.reply(" | ".join([getname(o) for o in Bus.objs]))
Ejemplo n.º 3
0
 def start(self):
     if not self.name:
         self.name = getname(self.func)
     timer = threading.Timer(self.sleep, self.run)
     timer.setName(self.name)
     timer.setDaemon(True)
     timer.sleep = self.sleep
     timer.state = self.state
     timer.state.starttime = time.time()
     timer.state.latest = time.time()
     timer.func = self.func
     timer.start()
     self.timer = timer
     return timer
Ejemplo n.º 4
0
def launch(func, *args, **kwargs):
    name = kwargs.get("name", obj.getname(func))
    t = Thr(func, *args, thrname=name, daemon=True)
    t.start()
    return t