]> git.proxmox.com Git - rustc.git/blame - src/libstd/sys/sgx/abi/thread.rs
New upstream version 1.34.2+dfsg1
[rustc.git] / src / libstd / sys / sgx / abi / thread.rs
CommitLineData
0731742a
XL
1use fortanix_sgx_abi::Tcs;
2
9fa01778 3/// Gets the ID for the current thread. The ID is guaranteed to be unique among
0731742a
XL
4/// all currently running threads in the enclave, and it is guaranteed to be
5/// constant for the lifetime of the thread. More specifically for SGX, there
6/// is a one-to-one correspondence of the ID to the address of the TCS.
7pub fn current() -> Tcs {
8 extern "C" { fn get_tcs_addr() -> Tcs; }
9 unsafe { get_tcs_addr() }
10}