Replace ScopedTLS::unsafe_get by ScopedTLS::into_slots

We only ever look at the slots after we are done with the thread pool,
so we don't need to expose any unsafety to inspect the slots.
This commit is contained in:
Anthony Ramine 2020-04-04 22:26:58 +02:00
parent 5d6c5132c1
commit e7cb736796
2 changed files with 6 additions and 8 deletions

View file

@ -71,9 +71,8 @@ impl<'scope, T: Send> ScopedTLS<'scope, T> {
RefMut::map(opt, |x| x.as_mut().unwrap())
}
/// Unsafe access to the slots. This can be used to access the TLS when
/// the caller knows that the pool does not have access to the TLS.
pub unsafe fn unsafe_get(&self) -> &[RefCell<Option<T>>] {
&self.slots
/// Returns the slots, consuming the scope.
pub fn into_slots(self) -> Box<[RefCell<Option<T>>]> {
self.slots
}
}