13 #ifndef OPAL_THREADS_TSD_H
14 #define OPAL_THREADS_TSD_H
16 #include "opal_config.h"
18 #if OPAL_HAVE_POSIX_THREADS
20 #elif OPAL_HAVE_SOLARIS_THREADS
24 #include "opal/constants.h"
139 #elif OPAL_HAVE_POSIX_THREADS
147 return pthread_key_create(key, destructor);
153 return pthread_key_delete(key);
159 return pthread_setspecific(key, value);
165 *valuep = pthread_getspecific(key);
169 #elif OPAL_HAVE_SOLARIS_THREADS
177 return thr_keycreate(key, destructor);
189 return thr_setspecific(key, value);
195 return thr_getspecific(key, valuep);
198 #elif defined(__WINDOWS__)
212 return (*key == TLS_OUT_OF_INDEXES) ? OPAL_ERROR : OPAL_SUCCESS;
220 return (key == 0) ? OPAL_ERROR : OPAL_SUCCESS;
226 BOOL ret = TlsSetValue(key, (LPVOID) value);
228 return (ret) ? OPAL_SUCCESS : OPAL_ERROR;
234 *valuep = TlsGetValue(key);
Functions for multi-threaded applications using Libevent.
OPAL_DECLSPEC int opal_tsd_key_create(opal_tsd_key_t *key, opal_tsd_destructor_t destructor)
Create thread-specific data key.
Definition: tsd.c:60
OPAL_DECLSPEC int opal_tsd_setspecific(opal_tsd_key_t key, void *value)
Set a thread-specific data value.
Definition: tsd.c:101
void(* opal_tsd_destructor_t)(void *value)
Prototype for callback when tsd data is being destroyed.
Definition: tsd.h:40
OPAL_DECLSPEC int opal_tsd_key_delete(opal_tsd_key_t key)
Delete a thread-specific data key.
Definition: tsd.c:88
void * opal_tsd_key_t
Typedef for thread-specific data key.
Definition: tsd.h:47
OPAL_DECLSPEC int opal_tsd_getspecific(opal_tsd_key_t key, void **valuep)
Get a thread-specific data value.
Definition: tsd.c:110