| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
fail to start. (GH-21201)
|
|
|
|
|
| |
Fix the threading.Thread class at fork: do nothing if the thread is
already stopped (ex: fork called at Python exit). Previously, an
error was logged in the child process.
|
|
|
|
|
| |
Add threading.__excepthook__ to allow retrieving the original value
of threading.excepthook in case it is set to a broken or a different
value.
|
|
|
| |
This allows to retrieve the functions that were set in these two, which might differ from sys.gettrace and sys.getprofile within a thread.
|
| |
|
|
|
|
|
| |
subinterpreters (GH-14049)" (GH-19456)
This reverts commit 066e5b1a917ec2134e8997d2cadd815724314252.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add a private _at_fork_reinit() method to _thread.Lock,
_thread.RLock, threading.RLock and threading.Condition classes:
reinitialize the lock after fork in the child process; reset the lock
to the unlocked state.
Rename also the private _reset_internal_locks() method of
threading.Event to _at_fork_reinit().
* Add _PyThread_at_fork_reinit() private function. It is excluded
from the limited C API.
* threading.Thread._reset_internal_locks() now calls
_at_fork_reinit() on self._tstate_lock rather than creating a new
Python lock object.
|
|
|
|
|
|
| |
Remove daemon threads from :mod:`concurrent.futures` by adding
an internal `threading._register_atexit()`, which calls registered functions
prior to joining all non-daemon threads. This allows for compatibility
with subinterpreters, which don't support daemon threads.
|
|
|
|
|
| |
If fork was not called by a thread spawned by threading.Thread,
threading._after_fork() now creates a _MainThread instance for
_main_thread, instead of a _DummyThread instance.
|
|
|
|
|
|
| |
* Use the 'p' format unit instead of manually called PyObject_IsTrue().
* Pass boolean value instead 0/1 integers to functions that needs boolean.
* Convert some arguments to boolean only once.
|
| |
|
|
|
|
|
| |
(GH-15228)" (GH-15338)
This reverts commit d3dcc92778807ae8f7ebe85178f36a29711cd478.
|
|
|
|
|
| |
Add threading.Thread.__del__() method to ensure that the thread state
lock is removed from the _shutdown_locks list when a thread
completes.
|
| |
|
|
|
| |
Rephrase and clarify that "the entire Python program exits when only daemon threads are left". This matches the documentation at https://docs.python.org/3/library/threading.html#thread-objects.
|
|
|
|
|
|
|
|
|
|
|
|
| |
In a subinterpreter, spawning a daemon thread now raises an
exception. Daemon threads were never supported in subinterpreters.
Previously, the subinterpreter finalization crashed with a Pyton
fatal error if a daemon thread was still running.
* Add _thread._is_main_interpreter()
* threading.Thread.start() now raises RuntimeError if the thread is a
daemon thread and the method is called from a subinterpreter.
* The _thread module now uses Argument Clinic for the new function.
* Use textwrap.dedent() in test_threading.SubinterpThreadingTests
|
|
|
| |
Remove the _tstate_lock from _shutdown_locks, don't remove None.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix a race condition at Python shutdown when waiting for threads.
Wait until the Python thread state of all non-daemon threads get
deleted (join all non-daemon threads), rather than just wait until
Python threads complete.
* Add threading._shutdown_locks: set of Thread._tstate_lock locks
of non-daemon threads used by _shutdown() to wait until all Python
thread states get deleted. See Thread._set_tstate_lock().
* Add also threading._shutdown_locks_lock to protect access to
threading._shutdown_locks.
* Add test_finalization_shutdown() test.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add a new threading.excepthook() function which handles uncaught
Thread.run() exception. It can be overridden to control how uncaught
exceptions are handled.
threading.ExceptHookArgs is not documented on purpose: it should not
be used directly.
* threading.excepthook() and threading.ExceptHookArgs.
* Add _PyErr_Display(): similar to PyErr_Display(), but accept a
'file' parameter.
* Add _thread._excepthook(): C implementation of the exception hook
calling _PyErr_Display().
* Add _thread._ExceptHookArgs: structseq type.
* Add threading._invoke_excepthook_wrapper() which handles the gory
details to ensure that everything remains alive during Python
shutdown.
* Add unit tests.
|
|
|
|
| |
Add native thread ID (TID) to threading.Thread objects
(supported platforms: Windows, FreeBSD, Linux, macOS).
|
|
|
|
|
| |
(GH-11993)" (GH-13458)
This reverts commit 4959c33d2555b89b494c678d99be81a65ee864b0.
|
| |
|
| |
|
| |
|
|
|
| |
Add a deprecated warning for the threading.Thread.isAlive() method.
|
| |
|
|
|
|
| |
bpo-31516: current_thread() should not return a dummy thread at shutdown
|
|
|
|
|
|
| |
* Remove Setup.config
* Always define WITH_THREAD for compatibility.
|
|
|
|
|
|
|
|
| |
be joined on exit (#3111)
* bpo-18966: non-daemonic threads created by a multiprocessing.Process should be joined on exit
* Add NEWS blurb
|
|
|
|
| |
Instead use keyword only arguments to os.register_at_fork for each of the scenarios.
Updates the documentation for clarity.
|
|
|
|
|
|
| |
* bpo-16500: Use register_at_fork() in the threading module
* Update comment at top of _after_fork()
|
|
|
|
|
|
| |
* Doc nits for bpo-16500
* Fix more references
|
|
|
|
|
|
|
|
|
|
|
| |
* bpo-6532: Make the thread id an unsigned integer.
From C API side the type of results of PyThread_start_new_thread() and
PyThread_get_thread_ident(), the id parameter of
PyThreadState_SetAsyncExc(), and the thread_id field of PyThreadState
changed from "long" to "unsigned long".
* Restore a check in thread_get_ident().
|
| |
|
|\ |
|
| | |
|
|\ \
| |/ |
|
| |
| |
| |
| | |
Most fixes to Doc/ and Lib/ directories by Ville Skyttä.
|
|\ \
| |/ |
|
| |
| |
| |
| |
| | |
This was inadvertently changed in 644b677c2ae5 to use self._stderr
instead of _sys.stderr.
|
|/ |
|
|\ |
|
| |
| |
| |
| | |
Patch by Nir Soffer.
|
|\ \
| |/ |
|
| | |
|
|\ \
| |/
| |
| | |
threads.
|
| |
| |
| |
| | |
Original patch by Peter Saveliev.
|
|\ \
| |/
| |
| | |
AttributeError when sys.stderr is None.
|
| |
| |
| |
| | |
AttributeError when sys.stderr is None.
|
| |
| |
| |
| |
| | |
threading.Lock.acquire(), threading.RLock.acquire() and socket operations now
use a monotonic clock, instead of the system clock, when a timeout is used.
|