OpenMPI
0.1.1
|
Thread Specific Datastore Interface. More...
#include "opal_config.h"
#include "opal/constants.h"
Go to the source code of this file.
Typedefs | |
typedef void(* | opal_tsd_destructor_t )(void *value) |
Prototype for callback when tsd data is being destroyed. | |
typedef void * | opal_tsd_key_t |
Typedef for thread-specific data key. | |
Functions | |
OPAL_DECLSPEC int | opal_tsd_key_create (opal_tsd_key_t *key, opal_tsd_destructor_t destructor) |
Create thread-specific data key. More... | |
OPAL_DECLSPEC int | opal_tsd_key_delete (opal_tsd_key_t key) |
Delete a thread-specific data key. More... | |
OPAL_DECLSPEC int | opal_tsd_setspecific (opal_tsd_key_t key, void *value) |
Set a thread-specific data value. More... | |
OPAL_DECLSPEC int | opal_tsd_getspecific (opal_tsd_key_t key, void **valuep) |
Get a thread-specific data value. More... | |
Thread Specific Datastore Interface.
Functions for providing thread-specific datastore capabilities.
OPAL_DECLSPEC int opal_tsd_getspecific | ( | opal_tsd_key_t | key, |
void ** | valuep | ||
) |
Get a thread-specific data value.
Get the data associated with the given key, as set by opal_tsd_setspecific(). If opal_tsd_setspecific() hasn't been called in the current thread with the given key, NULL is returned in valuep.
key[in] | Thread specific data key to modify |
value[out] | Value to associate with key |
OPAL_SUCCESS | Success |
ENOMEM | Insufficient memory exists to associate the value with the key |
EINVAL | Invalid key |
OPAL_DECLSPEC int opal_tsd_key_create | ( | opal_tsd_key_t * | key, |
opal_tsd_destructor_t | destructor | ||
) |
Create thread-specific data key.
Create a thread-specific data key visible to all threads in the current process. The returned key is valid in all threads, although the values bound to the key by opal_tsd_setspecific() are allocated on a per-thread basis and persist for the life of the calling thread.
Upon key creation, the value NULL is associated with the new key in all active threads. When a new thread is created, the value NULL is associated with all defined keys in the new thread.
The destructor parameter may be NULL. At thread exit, if destructor is non-NULL AND the thread has a non-NULL value associated with the key, the function is called with the current value as its argument.
key[out] | The key for accessing thread-specific data |
destructor[in] | Cleanup function to call when a thread exits |
OPAL_SUCCESS | Success |
EAGAIN | The system lacked the necessary resource to create another thread specific data key |
ENOMEM | Insufficient memory exists to create the key |
OPAL_DECLSPEC int opal_tsd_key_delete | ( | opal_tsd_key_t | key | ) |
Delete a thread-specific data key.
Delete a thread-specific data key previously returned by opal_tsd_key_create(). The destructor associated with the key is not fired in any thread and memory cleanup is the responsibility of the caller.
key[in] | The key for accessing thread-specific data |
OPAL_SUCCESS | Success |
EINVAL | Invalid key |
OPAL_DECLSPEC int opal_tsd_setspecific | ( | opal_tsd_key_t | key, |
void * | value | ||
) |
Set a thread-specific data value.
Associates value with key in the current thread. The value for the key in other threads is not changed. Different threads may assign different values to the same key.
key[in] | Thread specific data key to modify |
value[in] | Value to associate with key |
OPAL_SUCCESS | Success |
ENOMEM | Insufficient memory exists to associate the value with the key |
EINVAL | Invalid key |