mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
gh-110481: Implement inter-thread queue for biased reference counting (#114824)
Biased reference counting maintains two refcount fields in each object: `ob_ref_local` and `ob_ref_shared`. The true refcount is the sum of these two fields. In some cases, when refcounting operations are split across threads, the ob_ref_shared field can be negative (although the total refcount must be at least zero). In this case, the thread that decremented the refcount requests that the owning thread give up ownership and merge the refcount fields.
This commit is contained in:
parent
a225520af9
commit
a3af3cb4f4
21 changed files with 418 additions and 11 deletions
|
@ -637,6 +637,10 @@ PyOS_AfterFork_Child(void)
|
|||
tstate->native_thread_id = PyThread_get_thread_native_id();
|
||||
#endif
|
||||
|
||||
#ifdef Py_GIL_DISABLED
|
||||
_Py_brc_after_fork(tstate->interp);
|
||||
#endif
|
||||
|
||||
status = _PyEval_ReInitThreads(tstate);
|
||||
if (_PyStatus_EXCEPTION(status)) {
|
||||
goto fatal_error;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue