Repository navigation
Commit 46ea558
committed
Make weakref dereference lock-free.
In the free-threaded build, _PyWeakref_GET_REF() no longer takes the
striped weakref list lock. The referent's memory stays readable if it
is freed concurrently because object heaps delay page reuse with QSBR,
and wr_object only ever transitions from the referent to Py_None, so
_Py_TryIncrefCompare() is sufficient.
clear_weakref_lock_held() now uses release stores instead of
sequentially consistent stores. The weakref list lock orders the list
updates, and the lock-free read only requires that the store of Py_None
happens before the referent's memory can be reused.1 parent d3ada45 commit 46ea558
3 files changed
Lines changed: 16 additions & 12 deletions
File tree
- Include/internal
- Misc/NEWS.d/next/Core_and_Builtins
- Objects
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
| 77 | + | |
| 78 | + | |
78 | 79 | | |
79 | 80 | | |
80 | 81 | | |
81 | 82 | | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
86 | 90 | | |
87 | | - | |
88 | 91 | | |
89 | 92 | | |
90 | | - | |
91 | 93 | | |
92 | | - | |
93 | 94 | | |
94 | 95 | | |
95 | | - | |
96 | 96 | | |
| 97 | + | |
97 | 98 | | |
98 | 99 | | |
99 | 100 | | |
| |||
108 | 109 | | |
109 | 110 | | |
110 | 111 | | |
111 | | - | |
112 | 112 | | |
| 113 | + | |
113 | 114 | | |
114 | 115 | | |
115 | 116 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
88 | 88 | | |
89 | | - | |
| 89 | + | |
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| |||
0 commit comments