diff options
Diffstat (limited to 'ctr-std/src')
| -rw-r--r-- | ctr-std/src/sys/unix/thread.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/ctr-std/src/sys/unix/thread.rs b/ctr-std/src/sys/unix/thread.rs index 21224ad..76aa55a 100644 --- a/ctr-std/src/sys/unix/thread.rs +++ b/ctr-std/src/sys/unix/thread.rs @@ -80,6 +80,24 @@ impl Thread { debug_assert_eq!(ret, 0); } } + + #[allow(dead_code)] + pub fn id(&self) -> ThreadHandle { + self.handle + } + + #[allow(dead_code)] + pub fn into_id(self) -> ThreadHandle { + let handle = self.handle; + mem::forget(self); + handle + } +} + +impl Drop for Thread { + fn drop(&mut self) { + unsafe { ::libctru::threadDetach(self.handle) } + } } pub mod guard { |