2018-08-30 14:18:55 +02:00
|
|
|
// run-pass
|
2015-08-31 10:28:07 -07:00
|
|
|
// no-prefer-dynamic
|
2016-02-11 12:34:41 +01:00
|
|
|
// ignore-emscripten no threads support
|
2022-04-26 10:43:00 +00:00
|
|
|
|
2015-08-31 10:28:07 -07:00
|
|
|
static mut HIT: bool = false;
|
|
|
|
|
|
|
|
struct Foo;
|
|
|
|
|
|
|
|
impl Drop for Foo {
|
|
|
|
fn drop(&mut self) {
|
|
|
|
unsafe { HIT = true; }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
thread_local!(static FOO: Foo = Foo);
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
std::thread::spawn(|| {
|
|
|
|
FOO.with(|_| {});
|
|
|
|
}).join().unwrap();
|
|
|
|
assert!(unsafe { HIT });
|
|
|
|
}
|