diff --git a/lib/isc/win32/include/isc/thread.h b/lib/isc/win32/include/isc/thread.h index c7fde88681..85eaaebf16 100644 --- a/lib/isc/win32/include/isc/thread.h +++ b/lib/isc/win32/include/isc/thread.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: thread.h,v 1.16 2004/03/05 05:12:06 marka Exp $ */ +/* $Id: thread.h,v 1.17 2005/09/09 12:26:19 marka Exp $ */ #ifndef ISC_THREAD_H #define ISC_THREAD_H 1 @@ -68,6 +68,7 @@ typedef HANDLE isc_thread_t; typedef unsigned int isc_threadresult_t; typedef void * isc_threadarg_t; typedef isc_threadresult_t (WINAPI *isc_threadfunc_t)(isc_threadarg_t); +typedef DWORD isc_thread_key_t; #define isc_thread_self (unsigned long)GetCurrentThreadId @@ -82,6 +83,18 @@ isc_thread_join(isc_thread_t, isc_threadresult_t *); void isc_thread_setconcurrency(unsigned int level); +int +isc_key_create(isc_thread_key_t *key, void (*func)(void *)); + +int +isc_key_destroy(isc_thread_key_t key); + +void * +isc_key_getspecific(isc_thread_key); + +int +isc_key_setspecific(isc_thread_key_t key, void *value); + ISC_LANG_ENDDECLS #endif /* ISC_THREAD_H */ diff --git a/lib/isc/win32/libisc.def b/lib/isc/win32/libisc.def index 160761f62d..acfddb4cc8 100644 --- a/lib/isc/win32/libisc.def +++ b/lib/isc/win32/libisc.def @@ -139,6 +139,10 @@ isc_interfaceiter_first isc_interfaceiter_next isc_interval_iszero isc_interval_set +isc_key_create +isc_key_destroy +isc_key_getspecific +isc_key_setspecific isc_keyboard_canceled isc_keyboard_close isc_keyboard_getchar diff --git a/lib/isc/win32/thread.c b/lib/isc/win32/thread.c index 4f1adde6d1..b07a28d68d 100644 --- a/lib/isc/win32/thread.c +++ b/lib/isc/win32/thread.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: thread.c,v 1.18 2004/03/05 05:11:59 marka Exp $ */ +/* $Id: thread.c,v 1.19 2005/09/09 12:26:19 marka Exp $ */ #include @@ -66,3 +66,26 @@ isc_thread_setconcurrency(unsigned int level) { * call exists */ } + +void * +isc_key_getspecific(isc_thread_key_t key) { + return(TlsGetValue(key)); +} + +int +isc_key_setspecific(isc_thread_key_t key, void *value) { + return (TlsSetValue(key, value) ? 0 : GetLastError()); +} + +int +isc_key_create(isc_thread_key_t *key, void (*func)(void *)) { + *key = TlsAlloc(); + + return ((*key == -1) ? 0 : GetLastError()); +} + +int +isc_key_destroy(isc_thread_key_t key) { + return (TlsFree(key) ? 0 : GetLastError()); +} + \ No newline at end of file