Exemple #1
0
    def start(self):
        """schedule to start the greenlet that runs this thread's function

        :raises: `RuntimeError` if the thread has already been started
        """
        if self._started:
            raise RuntimeError("thread already started")

        def run():
            try:
                self.run(*self._args, **self._kwargs)
            finally:
                self._deactivate()

        self._glet = scheduler.greenlet(run)
        scheduler.schedule(self._glet)
        self._activate()
Exemple #2
0
    def start(self):
        """schedule to start the greenlet that runs this thread's function

        :raises: `RuntimeError` if the thread has already been started
        """
        if self._started:
            raise RuntimeError("thread already started")
        def run():
            try:
                self.run(*self._args, **self._kwargs)
            except SystemExit:
                # only shut down the thread, not the whole process
                pass
            finally:
                self._deactivate()
        self._glet = scheduler.greenlet(run)
        scheduler.schedule(self._glet)
        self._activate()
Exemple #3
0
    def start(self):
        """schedule to start the greenlet that runs this thread's function

        :raises: `RuntimeError` if the thread has already been started
        """
        if self._started:
            raise RuntimeError("thread already started")

        def run():
            try:
                self.run(*self._args, **self._kwargs)
            except SystemExit:
                # only shut down the thread, not the whole process
                pass
            finally:
                self._deactivate()

        self._glet = scheduler.greenlet(run)
        self._ident = id(self._glet)
        scheduler.schedule(self._glet)
        self._activate()
 def health_monitor(self, pid, tmpfd, tmpfname):
     checker = scheduler.greenlet(self.health_monitor_checker,
             args=(pid, tmpfd, tmpfname))
     scheduler.schedule(checker)
     self.health_checks[pid] = checker
 def _post_worker_fork(self):
     self.original = False
     self.readiness_notifier = scheduler.greenlet(self.notify_readiness)
     scheduler.schedule(self.readiness_notifier)