Struct style::scoped_tls::ScopedTLS [] [src]

pub struct ScopedTLS<'scope, T: Send> { /* fields omitted */ }

A scoped TLS set, that is alive during the 'scope lifetime.

We use this on Servo to construct thread-local contexts, but clear them once we're done with restyling.

Methods

impl<'scope, T: Send> ScopedTLS<'scope, T>
[src]

[src]

Create a new scoped TLS that will last as long as this rayon threadpool reference.

[src]

Return an immutable reference to the Option<T> that this thread owns.

[src]

Return a mutable reference to the Option<T> that this thread owns.

[src]

Ensure that the current data this thread owns is initialized, or initialize it using f. We want ensure() to be fast and inline, and we want to inline the memmove that initializes the Option. But we don't want to inline space for the entire large T struct in our stack frame. That's why we hand f a mutable borrow to write to instead of just having it return a T.

Important traits for &'a mut [u8]
[src]

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.

Trait Implementations

impl<'scope, T: Send> Sync for ScopedTLS<'scope, T>
[src]

The scoped TLS is Sync because no more than one worker thread can access a given slot.