File tree 1 file changed +17
-0
lines changed
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ static inline PyObject* _Py_FROM_GC(PyGC_Head *gc) {
43
43
# define _PyGC_BITS_FINALIZED (2)
44
44
# define _PyGC_BITS_UNREACHABLE (4)
45
45
# define _PyGC_BITS_FROZEN (8)
46
+ # define _PyGC_BITS_SHARED (16)
46
47
#endif
47
48
48
49
/* True if the object is currently tracked by the GC. */
@@ -68,6 +69,22 @@ static inline int _PyObject_GC_MAY_BE_TRACKED(PyObject *obj) {
68
69
return 1 ;
69
70
}
70
71
72
+ #ifdef Py_GIL_DISABLED
73
+
74
+ /* True if an object is shared between multiple threads and
75
+ * needs special purpose when freeing to do the possibility
76
+ * of in-flight lock-free reads occuring */
77
+ static inline int _PyObject_GC_IS_SHARED (PyObject * op ) {
78
+ return (op -> ob_gc_bits & _PyGC_BITS_SHARED ) != 0 ;
79
+ }
80
+ #define _PyObject_GC_IS_SHARED (op ) _PyObject_GC_IS_SHARED(_Py_CAST(PyObject*, op))
81
+
82
+ static inline void _PyObject_GC_SET_SHARED (PyObject * op ) {
83
+ op -> ob_gc_bits |= _PyGC_BITS_SHARED ;
84
+ }
85
+ #define _PyObject_GC_SET_SHARED (op ) _PyObject_GC_SET_SHARED(_Py_CAST(PyObject*, op))
86
+
87
+ #endif
71
88
72
89
/* Bit flags for _gc_prev */
73
90
/* Bit 0 is set when tp_finalize is called */
You can’t perform that action at this time.
0 commit comments