mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
win32: minimal isc_key_*() implementation
This commit is contained in:
@@ -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 */
|
||||
|
@@ -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
|
||||
|
@@ -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 <config.h>
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
Reference in New Issue
Block a user