32 #ifndef _QORE_QORETHREADLOCALSTORAGE_H
34 #define _QORE_QORETHREADLOCALSTORAGE_H
68 pthread_key_create(&
key, 0);
73 pthread_key_delete(
key);
78 return (T *)pthread_getspecific(
key);
82 DLLLOCAL
void set(T *ptr) {
84 pthread_setspecific(
key, (
void *)ptr);
87 assert(!ptr || !pthread_getspecific(
key));
89 int rc = pthread_setspecific(
key, (
void *)ptr);
provides access to thread-local storage
Definition: QoreThreadLocalStorage.h:44
DLLLOCAL void destroy()
destroys the key
Definition: QoreThreadLocalStorage.h:72
DLLLOCAL QoreThreadLocalStorage()
creates the key
Definition: QoreThreadLocalStorage.h:57
DLLLOCAL QoreThreadLocalStorage & operator=(const QoreThreadLocalStorage &)
this function is not implemented; it is here as a private function in order to prohibit it from being...
DLLLOCAL void set(T *ptr)
sets the key's value
Definition: QoreThreadLocalStorage.h:82
DLLLOCAL T * get()
retrieves the key's value
Definition: QoreThreadLocalStorage.h:77
pthread_key_t key
the actual thread local storage key wrapped in this class
Definition: QoreThreadLocalStorage.h:47
DLLLOCAL void create()
creates the key
Definition: QoreThreadLocalStorage.h:67
DLLLOCAL ~QoreThreadLocalStorage()
destroys the key
Definition: QoreThreadLocalStorage.h:62