/// assert_eq!(*f.borrow(), 1);
/// *f.borrow_mut() = 3;
/// });
-/// }).detach();
+/// });
///
/// // we retain our original value of 2 despite the child thread
/// FOO.with(|f| {
pub dtor_running: UnsafeCell<bool>, // should be Cell
}
- unsafe impl<T> ::kinds::Sync for Key<T> { }
+ unsafe impl<T> ::marker::Sync for Key<T> { }
#[doc(hidden)]
impl<T> Key<T> {
// destructor as running for this thread so calls to `get` will return
// `None`.
*(*ptr).dtor_running.get() = true;
- ptr::read((*ptr).inner.get() as *const T);
+ ptr::read((*ptr).inner.get());
}
}
pub os: OsStaticKey,
}
- unsafe impl<T> ::kinds::Sync for Key<T> { }
+ unsafe impl<T> ::marker::Sync for Key<T> { }
struct Value<T: 'static> {
key: &'static Key<T>,
}
thread_local!(static FOO: Foo = foo());
- Thread::spawn(|| {
+ Thread::scoped(|| {
assert!(FOO.state() == State::Uninitialized);
FOO.with(|_| {
assert!(FOO.state() == State::Valid);
}
}
- Thread::spawn(move|| {
+ Thread::scoped(move|| {
drop(S1);
}).join().ok().unwrap();
}
}
}
- Thread::spawn(move|| unsafe {
+ Thread::scoped(move|| unsafe {
K1.with(|s| *s.get() = Some(S1));
}).join().ok().unwrap();
}