about summary refs log tree commit diff
path: root/library/std/src/process.rs
diff options
context:
space:
mode:
authorMarkus Everling <markuseverling@gmail.com>2024-05-08 06:48:07 +0000
committerMarkus Everling <markuseverling@gmail.com>2024-07-18 14:09:25 +0000
commitfe89962237e425f661ca36dd36113340188ac057 (patch)
treed827b33b3256cc4f8cc0ebd7b44c255060c8b14b /library/std/src/process.rs
parent36153f1a4e3162f0a143c7b3e468ecb3beb0008e (diff)
downloadrust-fe89962237e425f661ca36dd36113340188ac057.tar.gz
rust-fe89962237e425f661ca36dd36113340188ac057.zip
Update `ReentrantLock` implementation, add `CURRENT_ID` thread local.
This changes `ReentrantLock` to use `ThreadId` for the thread ownership check instead of the address of a thread local. Unlike TLS blocks, `ThreadId` is guaranteed to be unique across the lifetime of the process, so if any thread ever terminates while holding a `ReentrantLockGuard`, no other thread may ever acquire that lock again.

On platforms with 64-bit atomics, this is a very simple change. On other platforms, the approach used is slightly more involved, as explained in the module comment.

This also adds a `CURRENT_ID` thread local in addition to the already existing `CURRENT`. This allows us to access the current `ThreadId` without the relatively heavy machinery used by `thread::current().id()`.
Diffstat (limited to 'library/std/src/process.rs')
0 files changed, 0 insertions, 0 deletions