• Home
  • Raw
  • Download

Lines Matching +full:no +full:- +full:threads

59     """Set a profile function for all threads started from the threading module.
73 """Set a trace function for all threads started from the threading module.
138 def acquire(self, blocking=True, timeout=-1):
139 """Acquire a lock, blocking or non-blocking.
147 able to grab ownership of the lock. There is no return value in this
158 When invoked with the floating-point timeout argument set to a positive
180 by any thread), and if any other threads are blocked waiting for the
189 There is no return value.
193 raise RuntimeError("cannot release un-acquired lock")
194 self._count = count = self._count - 1
210 raise RuntimeError("cannot release un-acquired lock")
227 A condition variable allows one or more threads to wait until they are
274 self._lock.release() # No state to save
297 awakened or timed out, it re-acquires the lock and returns.
312 raise RuntimeError("cannot wait on un-acquired lock")
318 try: # restore state no matter what (e.g., KeyboardInterrupt)
352 waittime = endtime - _time()
360 """Wake up one or more threads waiting on this condition, if any.
365 This method wakes up at most n of the threads waiting for the condition
366 variable; it is a no-op if no threads are waiting.
370 raise RuntimeError("cannot notify on un-acquired lock")
383 """Wake up all threads waiting on this condition.
392 """Wake up all threads waiting on this condition.
413 # After Tim Peters' semaphore class, but not quite the same (no maximum)
430 which blocked threads are awakened should not be relied on. There is no
446 raise ValueError("can't specify timeout for non-blocking acquire")
457 timeout = endtime - _time()
462 self._value -= 1
564 All threads waiting for it to become true are awakened. Threads
575 Subsequently, threads calling wait() will block until set() is called to
606 # http://sourceware.org/pthreads-win32/manual/pthread_barrier_init.html and
611 # to be cyclic. Threads are not allowed into it until it has fully drained
613 # similar to 'draining' except that threads leave with a BrokenBarrierError,
614 # and a 'broken' state in which all threads get the exception.
618 Useful for synchronizing a fixed number of threads at known synchronization
619 points. Threads block on 'wait()' and are simultaneously awoken once they
625 """Create a barrier, initialised to 'parties' threads.
628 the threads after they have all entered the barrier and just prior to
637 self._state = 0 # 0 filling, 1 draining, -1 resetting, -2 broken
643 When the specified number of threads have started waiting, they are all
645 of the threads will have executed that callback prior to returning.
646 Returns an individual index number from 0 to 'parties-1'.
664 self._count -= 1
665 # Wake up any threads waiting for barrier to drain.
671 while self._state in (-1, 1):
679 # Optionally run the 'action' and release the threads waiting
704 # If we are the last thread to exit the barrier, signal any threads
708 if self._state in (-1, 1):
716 Any threads currently waiting will get the BrokenBarrier exception
723 #reset the barrier, waking up threads
724 self._state = -1
725 elif self._state == -2:
728 self._state = -1
736 Useful in case of error. Any currently waiting threads and threads
746 self._state = -2
751 """Return the number of threads required to trip the barrier."""
756 """Return the number of threads currently waiting at the barrier."""
766 return self._state == -2
780 # bpo-44422: Use a reentrant lock to allow reentrant calls to functions like
787 # Set of Thread._tstate_lock locks of non-daemon threads used by _shutdown()
795 Drop any shutdown locks that don't correspond to running threads anymore.
797 Calling this from time to time avoids an ever-growing _shutdown_locks
798 set when Thread objects are not joined explicitly. See bpo-37788.
807 # Main class for threads
831 the form "Thread-N" where N is a small decimal number.
849 name = _newname("Thread-%d")
883 # bpo-42350: If the fork happens when the thread is already stopped
923 raise RuntimeError("threads can only be started once")
963 # reported. Also, we only suppress them for daemonic threads;
964 # if a non-daemonic encounters this, something else is wrong.
1028 # and .is_alive(). Any number of threads _may_ call ._stop()
1029 # simultaneously (for example, if multiple threads are blocked in
1030 # .join() calls), and they're not serialized. That's harmless -
1049 "Remove current thread from the dict of currently running threads."
1061 called terminates -- either normally or through an unhandled exception
1067 is_alive() after join() to decide whether a timeout happened -- if the
1095 def _wait_for_tstate_lock(self, block=True, timeout=-1):
1114 # bpo-45274: lock.acquire() acquired the lock, but the function
1126 It has no semantics. Multiple threads may be given the same name. The
1155 This is a non-negative integer. See the get_native_id() function.
1182 main thread is not a daemon thread and therefore all threads created in
1185 The entire Python program exits when only daemon threads are left.
1297 # Python shutdown. It is mostly needed for daemon threads.
1345 # The timer class was contributed by Itamar Shtull-Trauring
1390 # Dummy thread class to represent threads not started here.
1395 # They are marked as daemon threads so we won't wait for them
1401 Thread.__init__(self, name=_newname("Dummy-%d"), daemon=True)
1474 The list includes daemonic threads, dummy thread objects created by
1475 current_thread(), and the main thread. It excludes terminated threads and
1476 threads that have not yet been started.
1487 """CPython internal: register *func* to be called before joining threads.
1490 non-daemon threads are joined in `_shutdown()`. It provides a similar
1513 Wait until the Python thread state of all non-daemon threads get deleted.
1515 # Obscure: other threads may be waiting to join _main_thread. That's
1517 # the main thread's tstate_lock - that won't happen until the interpreter
1519 # isn't enough: other threads may already be waiting on _tstate_lock.
1527 # Call registered threading atexit functions before threads are joined.
1542 # bpo-1596321: _shutdown() must be called in the main thread.
1545 # In this case, ignore _main_thread, similar behavior than for threads
1549 # Join all non-deamon threads
1563 # new threads can be spawned while we were waiting for the other
1564 # threads to complete
1575 # get thread-local implementation, either from the thread
1589 # by another (non-forked) thread. http://bugs.python.org/issue874900
1607 # reset _shutdown() locks: threads re-register their _tstate_lock below
1614 threads = set(_enumerate())
1615 threads.update(_dangling)
1616 for thread in threads: