Lines Matching refs:thread
61 The func will be passed to sys.setprofile() for each thread, before its
75 The func will be passed to sys.settrace() for each thread, before its run()
93 A reentrant lock must be released by the thread that acquired it. Once a
94 thread has acquired a reentrant lock, the same thread may acquire it again
95 without blocking; the thread must release it once for each time it has
106 A reentrant lock must be released by the thread that acquired it. Once a
107 thread has acquired a reentrant lock, the same thread may acquire it
108 again without blocking; the thread must release it once for each time it
141 When invoked without arguments: if this thread already owns the lock,
143 if another thread owns the lock, block until the lock is unlocked. Once
144 the lock is unlocked (not owned by any thread), then grab ownership, set
145 the recursion level to one, and return. If more than one thread is
180 by any thread), and if any other threads are blocked waiting for the
183 locked and owned by the calling thread.
185 Only call this method when the calling thread owns the lock. A
228 notified by another thread.
291 If the calling thread has not acquired the lock when this method is
296 variable in another thread, or until the optional timeout occurs. Once
362 If the calling thread has not acquired the lock when this method is
392 If the calling thread has not acquired the lock when this method
438 on entry, block, waiting until some other thread has called release() to
483 When the counter is zero on entry and another thread is waiting for it
484 to become larger than zero again, wake up that thread.
527 When the counter is zero on entry and another thread is waiting for it
528 to become larger than zero again, wake up that thread.
608 block until another thread calls set() to set the flag to true, or until
733 # If we are the last thread to exit the barrier, signal any threads
756 #which clears when the last thread exits
802 # Helper to generate new thread names
807 # Active thread administration.
812 _active = {} # maps thread id to Thread object
817 # to wait until all Python thread states get deleted:
831 # If a lock was released, the corresponding thread has exited
839 """A class that represents a thread of control.
859 *name* is the thread name. By default, a unique name is constructed of
869 else to the thread.
912 # bpo-42350: If the fork happens when the thread is already stopped
919 # The thread isn't alive after fork: it doesn't have a tstate
939 """Start the thread's activity.
941 It must be called at most once per thread object. It arranges for the
942 object's run() method to be invoked in a separate thread of control.
945 same thread object.
949 raise RuntimeError("thread.__init__() not called")
965 """Method representing the thread's activity.
977 # Avoid a refcycle if the thread is running a function with
978 # an argument that has a member that points to the thread.
984 # happen when a daemon thread wakes up at an unfortunate
1011 the underlying thread state (see pystate.h) gets deleted.
1048 # Normal case: C code at the end of the thread's life
1072 "Remove current thread from the dict of currently running threads."
1077 # could try to acquire the lock again in the same thread, (in
1081 """Wait until the thread terminates.
1083 This blocks the calling thread until the thread whose join() method is
1091 thread is still alive, the join() call timed out.
1094 block until the thread terminates.
1096 A thread can be join()ed many times.
1099 thread as that would cause a deadlock. It is also an error to join() a
1100 thread before it has been started and attempts to do so raises the same
1107 raise RuntimeError("cannot join thread before it is started")
1109 raise RuntimeError("cannot join current thread")
1119 # Issue #18808: wait for the thread state to be gone.
1120 # At the end of the thread's life, after all knowledge of the thread
1163 """Thread identifier of this thread or None if it has not been started.
1166 identifiers may be recycled when a thread exits and another thread is
1167 created. The identifier is available even after the thread has exited.
1176 """Native integral thread ID of this thread, or None if it has not been started.
1186 """Return whether the thread is alive.
1201 """A boolean value indicating whether this thread is a daemon thread.
1204 raised. Its initial value is inherited from the creating thread; the
1205 main thread is not a daemon thread and therefore all threads created in
1206 the main thread default to daemon = False.
1219 raise RuntimeError("cannot set daemon status of active thread")
1223 """Return whether this thread is a daemon.
1234 """Set whether this thread is a daemon.
1256 """Set the name string for this thread.
1277 'exc_type exc_value exc_traceback thread')
1292 elif args.thread is not None:
1293 stderr = args.thread._stderr
1296 # when the thread was created
1299 # do nothing if sys.stderr is None and args.thread is None
1302 if args.thread is not None:
1303 name = args.thread.name
1306 print(f"Exception in thread {name}:",
1333 def invoke_excepthook(thread):
1340 args = ExceptHookArgs([*sys_exc_info(), thread])
1350 stderr = thread._stderr
1398 # Special thread class to represent the main thread
1413 # Dummy thread class to represent threads not started here.
1441 assert False, "cannot join a dummy thread"
1447 """Return the current Thread object, corresponding to the caller's thread of control.
1449 If the caller's thread of control was not created through the threading
1450 module, a dummy thread object with limited functionality is returned.
1459 """Return the current Thread object, corresponding to the caller's thread of control.
1497 The list includes daemonic threads, dummy thread objects created by
1498 current_thread(), and the main thread. It excludes terminated threads and
1528 # Create the main thread object,
1536 Wait until the Python thread state of all non-daemon threads get deleted.
1540 # the main thread's tstate_lock - that won't happen until the interpreter
1555 # Main thread
1558 # The main thread isn't finished yet, so its thread state lock can't
1565 # bpo-1596321: _shutdown() must be called in the main thread.
1566 # If the threading module was not imported by the main thread,
1567 # _main_thread is the thread which imported the threading module.
1591 """Return the main thread object.
1593 In normal conditions, the main thread is the thread from which the
1598 # get thread-local implementation, either from the thread
1612 # by another (non-forked) thread. http://bugs.python.org/issue874900
1617 # fork() only copied the current thread; clear references to others.
1623 # fork() was called in a thread which was not spawned
1624 # by threading.Thread. For example, a thread spawned
1625 # by thread.start_new_thread().
1635 # Dangling thread instances must still have their locks reset,
1639 for thread in threads:
1642 if thread is current:
1643 # There is only one active thread. We reset the ident to
1645 thread._reset_internal_locks(True)
1647 thread._ident = ident
1648 new_active[ident] = thread
1651 thread._reset_internal_locks(False)
1652 thread._stop()