| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
We need to load `ob_tid` atomically; it may be set to zero in another thread without any intervening operations that establish a happens-before relationship. Using a relaxed load should be sufficient; we do not depend on the store publishing any other information. Examples: The load in `_Py_IsOwnedByCurrentThread()`: https://github.com/python/cpython/blob/4b10e209c76f9f36f8ae2e4d713b3a01591c1856/Include/object.h#L306 races with the store in `_Py_ExplicitMergeRefcount()` ([example](https://gist.github.com/mpage/0342ebce4b5b446689c41cdd72f16e61)): https://github.com/python/cpython/blob/4b10e209c76f9f36f8ae2e4d713b3a01591c1856/Objects/object.c#L421 and the store in `_Py_MergeZeroLocalRefcount()` ([example](https://gist.github.com/mpage/eaec11eda6e2d988ed0dd2bcfd6d606b)): https://github.com/python/cpython/blob/4b10e209c76f9f36f8ae2e4d713b3a01591c1856/Objects/object.c#L378
| Back | FazBrowse Home | New Git URL |
We need to load ob_tid atomically; it may be set to zero in another thread without any intervening operations that establish a happens-before relationship.
Using a relaxed load should be sufficient; we do not depend on the store publishing any other information.
Examples:
The load in _Py_IsOwnedByCurrentThread():
cpython/Include/object.h
Line 306 in 4b10e20
races with the store in _Py_ExplicitMergeRefcount() (example):
cpython/Objects/object.c
Line 421 in 4b10e20
and the store in _Py_MergeZeroLocalRefcount() (example):
cpython/Objects/object.c
Line 378 in 4b10e20