From c1573807d59082cf705028a302b8ba15de88ab3e Mon Sep 17 00:00:00 2001 From: Fenrir Date: Mon, 22 Jan 2018 00:30:33 -0700 Subject: [PATCH] Restore thread APIs that were accidentally deleted Oops. --- ctr-std/src/sys/unix/thread.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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 {