Thread local storage

Contains API for thread local storage (TLS). More...

Typedefs

typedef VOID(* TLS_DESTRUCTOR )(VOID *)
typedef ADDRINT PIN_TLS_INDEX

Functions

VOID * OS_TlsGetBaseAddress ()
PIN_TLS_INDEX OS_TlsAlloc (TLS_DESTRUCTOR dest)
BOOL_T OS_TlsFree (PIN_TLS_INDEX idx)
VOID * OS_TlsGetValue (PIN_TLS_INDEX idx)
VOID * OS_TlsGetValueForThread (PIN_TLS_INDEX idx, NATIVE_TID ntid)
VOID ** OS_TlsGetArrayAddress (void)
VOID ** OS_TlsGetArrayAddressForThread (NATIVE_TID ntid)
BOOL_T OS_TlsSetValue (PIN_TLS_INDEX idx, VOID *val)
BOOL_T OS_TlsSetValueForThread (PIN_TLS_INDEX idx, NATIVE_TID ntid, VOID *val)
VOID OS_TlsFreeThreadTls (NATIVE_TID ntid)
BOOL_T OS_TlsAddStaticTlsDestructor (TLS_DESTRUCTOR destructor)

Detailed Description


Typedef Documentation

typedef ADDRINT PIN_TLS_INDEX
 

Type for index inside the dynamic TLS.

typedef VOID(* TLS_DESTRUCTOR)(VOID *)
 

Prototype for TLS value desctructor function. The only argument for this function is the value stored in TLS.


Function Documentation

BOOL_T OS_TlsAddStaticTlsDestructor TLS_DESTRUCTOR  destructor  ) 
 

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 & OS X*
CPU: All

PIN_TLS_INDEX OS_TlsAlloc TLS_DESTRUCTOR  dest  ) 
 

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 & OS X*
CPU: All

BOOL_T OS_TlsFree PIN_TLS_INDEX  idx  ) 
 

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 & OS X*
CPU: All

VOID OS_TlsFreeThreadTls NATIVE_TID  ntid  ) 
 

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 & OS X*
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 & OS X*
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 & OS X*
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 & OS X*
CPU: All

VOID* OS_TlsGetValue PIN_TLS_INDEX  idx  ) 
 

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 & OS X*
CPU: All

VOID* OS_TlsGetValueForThread PIN_TLS_INDEX  idx,
NATIVE_TID  ntid
 

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 & OS X*
CPU: All

BOOL_T OS_TlsSetValue PIN_TLS_INDEX  idx,
VOID *  val
 

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 & OS X*
CPU: All

BOOL_T OS_TlsSetValueForThread PIN_TLS_INDEX  idx,
NATIVE_TID  ntid,
VOID *  val
 

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 & OS X*
CPU: All


Generated on Sun Aug 27 14:29:31 2017 for PinCRT by  doxygen 1.4.6