[−][src]Struct sunrise_kernel::process::thread_local_storage::TLSManager
TLS allocator
Each process holds a TLSManager
in its ProcessStruct.
When a thread is being created, we ask the TLSManager
to allocate a TLS for it, and when
it dies we give it back to the manager so it can be re-used the next time this process spawns a thread.
When all of its TLS are occupied, the TLSManager
will expend its memory by allocating a new page.
Memory leak
The TLSManager
will never free the pages it manages, and they are leaked when the TLSManager
is dropped.
They will become available again after the process dies and its ProcessMemory is freed.
A TLSManager
will always be dropped at process's death, at the same time as the ProcessMemory
.
This prevents a dependency in the order in which the TLSManager
and the ProcessMemory
are dropped.
Fields
tls_pages: Vec<TLSPage>
Vec of tracked pages. When all slots are occupied, we allocate a new page.
Implementations
impl TLSManager
[src]
pub fn allocate_tls(
&mut self,
pmemory: &mut ProcessMemory
) -> Result<VirtualAddress, KernelError>
[src]
&mut self,
pmemory: &mut ProcessMemory
) -> Result<VirtualAddress, KernelError>
Allocates a new TLS.
This function will try to re-use free TLSs, and will only allocate when all TLS are in use.
The returned TLS still has to be bzeroed, has it may contain the data of a previous thread.
Error
Fails if the allocation fails.
pub unsafe fn free_tls(&mut self, tls: VirtualAddress)
[src]
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for TLSManager
impl Send for TLSManager
impl Sync for TLSManager
impl Unpin for TLSManager
impl UnwindSafe for TLSManager
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,