Haka: Thread local storage

Haka

- Main Page
- Modules
- Data Structures
- Files

Typedefs | Functions
Thread local storage

## Typedefs
typedef pthread_key_t | local_storage_t

## Functions
bool | local_storage_init (local_storage_t *key, void(*destructor)(void *))
bool | local_storage_destroy (local_storage_t *key)
void * | local_storage_get (local_storage_t *key)
bool | local_storage_set (local_storage_t *key, const void *value)

## Detailed Description

## Typedef Documentation

typedef pthread_key_t local_storage_t

Opaque local storage type.

## Function Documentation

bool local_storage_destroy | ( | local_storage_t * | key | ) |

Destroy a thread local storage.

Returns
  True on success. Use clear_error() to get details about the error.

void* local_storage_get | ( | local_storage_t * | key | ) |

Get the value of the thread local storage.

Returns
  The value associated with the current thread.

bool local_storage_init | ( | local_storage_t * | key,
|  | void(*)(void *) | destructor
| ) |  |

Initialize thread local storage. The parameter `destructor` allows to set a cleanup function to call when the storage is destroyed.

Returns
  True on success. Use clear_error() to get details about the error.

bool local_storage_set | ( | local_storage_t * | key,
|  | const void * | value
| ) |  |

Set the value of the thread local storage.

Returns
  True on success. Use clear_error() to get details about the error.