about summary refs log tree commit diff
path: root/src/libstd/sys
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2019-03-16 14:56:23 +0800
committerGitHub <noreply@github.com>2019-03-16 14:56:23 +0800
commit152ed3717b3387f9b79fbd6917bd3ce3b994a9a1 (patch)
treeac1ce25b3523b8c53d60910ec37f523bdbca6a0b /src/libstd/sys
parent9859b818c88ceae3c4c3620b06e27d07d84576f8 (diff)
parent67eabc6bec67e1953cb944f0654fada3151b7e21 (diff)
downloadrust-152ed3717b3387f9b79fbd6917bd3ce3b994a9a1.tar.gz
rust-152ed3717b3387f9b79fbd6917bd3ce3b994a9a1.zip
Rollup merge of #58949 - jethrogb:jb/sgx-thread-id, r=joshtriplett
SGX target: Expose thread id function in os module

In order to call `std::os::fortanix_sgx::usercalls::send`, you need the thread id. This exposes it through another function in `std::os::fortanix_sgx`.

I looked at how other platforms do this. On Windows and `cfg(unix)` you can get the OS handle from a `thread::JoinHandle`, but that's not sufficient, I need it for a `thread::Thread`. In the future, this functionality could be added to `thread::Thread` and this platform can follow suit.

r? @joshtriplett
Diffstat (limited to 'src/libstd/sys')
-rw-r--r--src/libstd/sys/sgx/abi/thread.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/libstd/sys/sgx/abi/thread.rs b/src/libstd/sys/sgx/abi/thread.rs
index 86fe09d0035..c17fa2d0015 100644
--- a/src/libstd/sys/sgx/abi/thread.rs
+++ b/src/libstd/sys/sgx/abi/thread.rs
@@ -4,6 +4,7 @@ use fortanix_sgx_abi::Tcs;
 /// all currently running threads in the enclave, and it is guaranteed to be
 /// constant for the lifetime of the thread. More specifically for SGX, there
 /// is a one-to-one correspondence of the ID to the address of the TCS.
+#[unstable(feature = "sgx_platform", issue = "56975")]
 pub fn current() -> Tcs {
     extern "C" { fn get_tcs_addr() -> Tcs; }
     unsafe { get_tcs_addr() }