[][src]Module sgx_tstd::sync

The Intel(R) Software Guard Extensions SDK already supports mutex and conditional variable synchronization mechanisms by means of the following API and data types defined in the Types and Enumerations section. Some functions included in the trusted Thread Synchronization library may make calls outside the enclave (OCALLs). If you use any of the APIs below, you must first import the needed OCALL functions from sgx_tstd.edl. Otherwise, you will get a linker error when the enclave is being built; see Calling Functions outside the Enclave for additional details. The table below illustrates the primitives that the Intel(R) SGX Thread Synchronization library supports, as well as the OCALLs that each API function needs.

Modules

atomic

Atomic types

Structs

Arc

A thread-safe reference-counting pointer. 'Arc' stands for 'Atomically Reference Counted'.

Barrier

A barrier enables multiple threads to synchronize the beginning of some computation.

BarrierWaitResult

A BarrierWaitResult is returned by wait when all threads in the Barrier have rendezvoused.

Once

A synchronization primitive which can be used to run a one-time global initialization. Useful for one-time initialization for FFI or related functionality. This type can only be constructed with the Once::new constructor.

OnceState

State yielded to call_once_force’s closure parameter. The state can be used to query the poison status of the Once.

PoisonError

A type of error which can be returned whenever a lock is acquired.

SgxCondvar

A Condition Variable

SgxMutex

A mutual exclusion primitive useful for protecting shared data

SgxMutexGuard

An RAII implementation of a "scoped lock" of a mutex. When this structure is dropped (falls out of scope), the lock will be unlocked.

SgxReentrantMutex

A re-entrant mutual exclusion

SgxReentrantMutexGuard

An RAII implementation of a "scoped lock" of a mutex. When this structure is dropped (falls out of scope), the lock will be unlocked.

SgxReentrantThreadMutex

The structure of sgx mutex.

SgxRwLock

A reader-writer lock

SgxRwLockReadGuard

RAII structure used to release the shared read access of a lock when dropped.

SgxRwLockWriteGuard

RAII structure used to release the exclusive write access of a lock when dropped.

SgxSpinlock
SgxSpinlockGuard
SgxThreadCondvar
SgxThreadMutex

The structure of sgx mutex.

SgxThreadRwLock

An OS-based reader-writer lock.

SgxThreadSpinlock
WaitTimeoutResult

A type indicating whether a timed wait on a condition variable returned due to a time out or not.

Weak

Weak is a version of Arc that holds a non-owning reference to the managed allocation. The allocation is accessed by calling upgrade on the Weak pointer, which returns an Option<Arc<T>>.

Enums

TryLockError

An enumeration of possible errors associated with a TryLockResult which can occur while trying to acquire a lock, from the [try_lock] method on a [Mutex] or the [try_read] and [try_write] methods on an [RwLock].

Constants

ONCE_INIT

Initialization value for static Once values.

Type Definitions

LockResult

A type alias for the result of a lock method which can be poisoned.

TryLockResult

A type alias for the result of a nonblocking locking method.