mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
gh-111569: Implement Python critical section API (gh-111571)
Critical sections are helpers to replace the global interpreter lock with finer grained locking. They provide similar guarantees to the GIL and avoid the deadlock risk that plain locking involves. Critical sections are implicitly ended whenever the GIL would be released. They are resumed when the GIL would be acquired. Nested critical sections behave as if the sections were interleaved.
This commit is contained in:
parent
0b718e6407
commit
31c90d5838
19 changed files with 630 additions and 7 deletions
|
@ -2371,7 +2371,7 @@ new_reference(PyObject *op)
|
|||
#else
|
||||
op->ob_tid = _Py_ThreadId();
|
||||
op->_padding = 0;
|
||||
op->ob_mutex = 0;
|
||||
op->ob_mutex = (struct _PyMutex){ 0 };
|
||||
op->ob_gc_bits = 0;
|
||||
op->ob_ref_local = 1;
|
||||
op->ob_ref_shared = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue