Contains API for thread local storage (TLS).
Typedef Documentation
Type for index inside the dynamic TLS.
Prototype for TLS value destructor function. The only argument for this function is the value stored in TLS.
Function Documentation
Add a destructor for all threads' static TLS. The destructor for static TLS is called on each thread termination, provided that the thread had an allocated static TLS.
- Parameters:
-
[in] | destructor | Destructor function that will be called with the pointer to the fixed TLS when a thread terminates. |
- Availability:
- O/S: Windows, Linux & macOS*
CPU: All
Allocates a new slot in the dynamic TLS.
- Parameters:
-
[in] | dest | Optional destructor function that will be called on each value stores in TLS when its corresponding thread dies. |
- Returns:
- Index for the newly allocated slot or OS_APIS_INVALID_PIN_TLS_INDEX on error.
- Availability:
- O/S: Windows, Linux & macOS*
CPU: All
Free a previously allocated slot in the dynamic TLS.
- Parameters:
-
[in] | idx | The index to free. |
- Returns:
- True on success.
- Availability:
- O/S: Windows, Linux & macOS*
CPU: All
Free all resources that are used for a particular thread's TLS. This function is usually called when a thread is about to exit.
- Parameters:
-
[in] | ntid | The thread ID for which the TLS need to be freed. |
- Availability:
- O/S: Windows, Linux & macOS*
CPU: All
VOID** OS_TlsGetArrayAddress |
( |
void |
| ) |
|
Return the address of the static TLS for the current thread
- Returns:
- Address of the static TLS for the current threads (which is a VOID* array).
- Availability:
- O/S: Windows, Linux & macOS*
CPU: All
VOID** OS_TlsGetArrayAddressForThread |
( |
NATIVE_TID |
ntid | ) |
|
Return the address of the static TLS for a particular thread
- Parameters:
-
[in] | ntid | The thread ID for which the static TLS will be retrieved. |
- Returns:
- Address of the static TLS for the specified threads (which is a VOID* array).
- Availability:
- O/S: Windows, Linux & macOS*
CPU: All
VOID* OS_TlsGetBaseAddress |
( |
| ) |
|
Return the base address for the application-wide TLS data structure. The TLS data structure is used to implement a TLS which is not based on segment registers.
- Returns:
- Pointer to the base address of the TLS data structure.
- Availability:
- O/S: Windows, Linux & macOS*
CPU: All
Get the value associated with a particular index from the current thread's dynamic TLS.
- Parameters:
-
[in] | idx | The index of the value to get. |
- Returns:
- Pointer to the value, or NULL otherwise.
- Availability:
- O/S: Windows, Linux & macOS*
CPU: All
Get the value associated with a particular index of a particular thread's dynamic TLS.
- Parameters:
-
[in] | idx | The index of the value to get. |
[in] | ntid | The thread ID for which the TLS value will be retrieved. |
- Returns:
- Pointer to the value, or NULL otherwise.
- Availability:
- O/S: Windows, Linux & macOS*
CPU: All
Set the value associated with a particular index in the current thread's dynamic TLS.
- Parameters:
-
[in] | idx | The index of the value to set. |
[in] | val | The new value to set. |
- Returns:
- True on success.
- Availability:
- O/S: Windows, Linux & macOS*
CPU: All
Set the value associated with a particular index in of a particular thread's dynamic TLS.
- Parameters:
-
[in] | idx | The index of the value to set. |
[in] | ntid | The thread ID for which the value will be set in its TLS. |
[in] | val | The new value to set. |
- Returns:
- True on success.
- Availability:
- O/S: Windows, Linux & macOS*
CPU: All