about summary refs log tree commit diff
path: root/src/test/run-pass/thinlto
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-10-10 04:04:51 -0700
committerGitHub <noreply@github.com>2016-10-10 04:04:51 -0700
commit6d620843f62b6cf3182528ffcaa877eba461bfbb (patch)
tree0556b5246e14a08e21735c1942854b23b7c819c6 /src/test/run-pass/thinlto
parenta7bfb1aba9d089a0464c03b3841e889c6ee7c4f1 (diff)
parent032bffa5b8ae6c3977884c4e10fd6ab6a5dc5ef6 (diff)
downloadrust-6d620843f62b6cf3182528ffcaa877eba461bfbb.tar.gz
rust-6d620843f62b6cf3182528ffcaa877eba461bfbb.zip
Auto merge of #36341 - sagebind:thread_id, r=alexcrichton
Add ThreadId for comparing threads

This adds the capability to store and compare threads with the current calling thread via a new struct, `std::thread::ThreadId`. Addresses the need outlined in issue #21507.

This avoids the need to add any special checks to the existing thread structs and does not rely on the system to provide an identifier for a thread, since it seems that this approach is unreliable and undesirable. Instead, this simply uses a lazily-created, thread-local `usize` whose value is copied from a global atomic counter. The code should be simple enough that it should be as much reliable as the `#[thread_local]` attribute it uses (however much that is).

`ThreadId`s can be compared directly for equality and have copy semantics.

Also see these other attempts:
- rust-lang/rust#29457
- rust-lang/rust#29448
- rust-lang/rust#29447

And this in the RFC repo: rust-lang/rfcs#1435
Diffstat (limited to 'src/test/run-pass/thinlto')
0 files changed, 0 insertions, 0 deletions