Thread-specific storage.
More...
Thread-specific storage.
Implements thread-specific storage (TSS), that is, memory locations that are individual for each thread. Each thread has its own slot for a memory address that can point to a (thread-specific) value. The value pointed to has to be managed, i.e., created and deleted, by the user.
Opaque type representing a TSS.
Creates thread-specific storage (TSS) pointer slots.
- Precondition
- The given TSS has not yet been created or has already been deleted.
- Returns
- EMBB_SUCCESS if storage could be created
EMBB_NOMEM if not enough memory was available
- Dynamic memory allocation
- embb_thread_get_max_count() pointers
- Concurrency
- Not thread-safe
- See also
- embb_tss_delete(), embb_thread_get_max_count()
- Parameters
-
int embb_tss_set |
( |
embb_tss_t * |
tss, |
|
|
void * |
value |
|
) |
| |
Sets thread-specific slot value of the current thread.
The value pointed to needs to be managed (created, deleted) by the user.
- Precondition
- The given TSS has been created
- Returns
- EMBB_SUCCESS if value could be set
EMBB_ERROR if no thread index could be obtained, that is, the maximum number of threads has been exceeded.
- Concurrency
- Thread-safe and lock-free
- See also
- embb_tss_get(), embb_thread_get_max_count()
- Parameters
-
[in,out] | tss | Pointer to TSS |
[in] | value | Pointer to be stored in TSS |
Gets thread-specific TSS slot value of the current thread.
- Precondition
- The given TSS has been created
- Returns
- Thread-specific value if embb_tss_set() has previously been called with a valid address. NULL, if no value was set or the calling thread could not obtain a thread-specific index.
- Concurrency
- Thread-safe and lock-free
- See also
- embb_tss_set()
- Parameters
-
Deletes all slots of the given TSS.
Does not delete the values pointed to.
- Precondition
tss
has been created successfully and is not NULL.
- Postcondition
- All slots are deleted
- Concurrency
- Not thread-safe
- See also
- embb_tss_create()
- Parameters
-
[in,out] | tss | Pointer to TSS |