def __init__(self, interval, function, args=[], kwargs={}): Thread.__init__(self) self.interval = interval self.function = function self.args = args self.kwargs = kwargs self.finished = Event()
def __init__(self): Thread.__init__(self, name=_newname("Dummy-%d")) # Thread.__block consumes an OS-level locking primitive, which # can never be used by a _DummyThread. Since a _DummyThread # instance is immortal, that's bad, so release this resource. del self._Thread__block self._Thread__started = True _active_limbo_lock.acquire() _active[_get_ident()] = self _active_limbo_lock.release()
def __init__(self, group=None, target=None, name=None, args=(), kwargs={}): ThreadBase.__init__(self) assert group is None self.__target = target self.__args = args self.__kwargs = kwargs if not name: import threading2 name = threading2._newname() current = current_thread() self.__dict__['daemon'] = current.daemon self.__dict__['name'] = name self.__thread = pm.PythonThread(self.run, None, name, name) threadId = _thread._add_thread(self.__thread, weakref.proxy(self)) self.__dict__['ident'] = threadId
def __init__(self, queue, count): Thread.__init__(self, name="Consumer") self.queue = queue self.count = count
def __init__(self, queue, quota): Thread.__init__(self, name="Producer") self.queue = queue self.quota = quota
def __init__(self): Thread.__init__(self, name="MainThread") self._Thread__started = True _active_limbo_lock.acquire() _active[_get_ident()] = self _active_limbo_lock.release()
def current_thread(): t = pm.Thread.getCurrentThread() return _thread._get_thread_wrapper(t, _create_thread_wrapper)
def __del__(self): # On interpreter shutdown, the _thread module might have # already been cleaned up. if _thread and _thread._remove_thread_id: _thread._remove_thread_id(self.ident)