pub struct Thread { /* private fields */ }Expand description
Wrapper around an IL2CPP VM thread attachment.
Use this type whenever your code touches IL2CPP from a thread that was not
created by the crate’s initialization flow. The common pattern is scoped
attachment via Thread::attach with auto_detach = true.
Implementations§
Source§impl Thread
impl Thread
Sourcepub fn detach(self)
pub fn detach(self)
Manually detaches the thread from the IL2CPP domain
This will detach the thread immediately and prevent auto-detachment on drop.
Sourcepub fn is_vm_thread(&self) -> bool
pub fn is_vm_thread(&self) -> bool
Checks if the thread is a VM thread
Sourcepub fn current() -> Option<Self>
pub fn current() -> Option<Self>
Gets the current attached thread
§Returns
Option<Self>- The current thread wrapper if attached, or None
Sourcepub fn attach(auto_detach: bool) -> Option<Self>
pub fn attach(auto_detach: bool) -> Option<Self>
Attaches the current OS thread to the IL2CPP domain.
If the thread is already attached, the existing thread handle is reused.
When auto_detach is true, dropping the returned value detaches the
thread automatically.
Returns None if the IL2CPP domain could not be resolved or the runtime
rejected the attachment request.
Sourcepub fn is_attached() -> bool
pub fn is_attached() -> bool
Checks if the current thread is attached to the IL2CPP domain