gh-114271: Make `thread._rlock` thread-safe in free-threaded builds by mpage · Pull Request #115102 · python/cpython
The ID of the owning thread (`rlock_owner`) may be accessed by multiple threads without holding the underlying lock; relaxed atomics are used in place of the previous loads/stores. The number of times that the lock has been acquired (`rlock_count`) is only ever accessed by the thread that holds the lock; we do not need to use atomics to access it. The embedded lock (`rlock_lock`) is already thread-safe.
bot
mentioned this pull request
mpage
marked this pull request as ready for review
woodruffw pushed a commit to woodruffw-forks/cpython that referenced this pull request
Mar 4, 2024…ilds (python#115102) The ID of the owning thread (`rlock_owner`) may be accessed by multiple threads without holding the underlying lock; relaxed atomics are used in place of the previous loads/stores. The number of times that the lock has been acquired (`rlock_count`) is only ever accessed by the thread that holds the lock; we do not need to use atomics to access it.
diegorusso pushed a commit to diegorusso/cpython that referenced this pull request
Apr 17, 2024…ilds (python#115102) The ID of the owning thread (`rlock_owner`) may be accessed by multiple threads without holding the underlying lock; relaxed atomics are used in place of the previous loads/stores. The number of times that the lock has been acquired (`rlock_count`) is only ever accessed by the thread that holds the lock; we do not need to use atomics to access it.
LukasWoodtli pushed a commit to LukasWoodtli/cpython that referenced this pull request
Jan 22, 2025…ilds (python#115102) The ID of the owning thread (`rlock_owner`) may be accessed by multiple threads without holding the underlying lock; relaxed atomics are used in place of the previous loads/stores. The number of times that the lock has been acquired (`rlock_count`) is only ever accessed by the thread that holds the lock; we do not need to use atomics to access it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters