Module sgx_tstd::sync[][src]

The Intel(R) Software Guard Extensions SDK already supports mutex and conditional variable synchronization mechanisms by means of the following APIand 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_tstdc.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_INIT value.

OnceState

State yielded to the call_once_force method which can be used to query whether the Once was previously poisoned or not.

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

The structure of sgx condition.

SgxThreadMutex

The structure of sgx mutex.

SgxThreadRwLock

An OS-based reader-writer lock.

SgxThreadSpinlock
Weak

Weak is a version of Arc that holds a non-owning reference to the managed value. The value 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.