]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
win32: minimal isc_key_*() implementation
authorMark Andrews <marka@isc.org>
Fri, 9 Sep 2005 12:31:53 +0000 (12:31 +0000)
committerMark Andrews <marka@isc.org>
Fri, 9 Sep 2005 12:31:53 +0000 (12:31 +0000)
lib/isc/win32/include/isc/thread.h
lib/isc/win32/libisc.def
lib/isc/win32/thread.c

index c7fde88681642f1f4fd6d6decb77480ee2d17811..faa4cdf21078dd874787feb2fa85c1c0741eb0e1 100644 (file)
@@ -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.16.18.1 2005/09/09 12:31:53 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;\r
 
 #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\r
+isc_key_create(isc_thread_key_t *key, void (*func)(void *));\r
+\r
+int\r
+isc_key_destroy(isc_thread_key_t key);\r
+\r
+void *\r
+isc_key_getspecific(isc_thread_key);\r
+\r
+int\r
+isc_key_setspecific(isc_thread_key_t key, void *value);\r
+\r
 ISC_LANG_ENDDECLS
 
 #endif /* ISC_THREAD_H */
index 160761f62d81712340197b4ed6e587e5672ac0b3..acfddb4cc8646b149c7e32665b8f3c748670e806 100644 (file)
@@ -139,6 +139,10 @@ isc_interfaceiter_first
 isc_interfaceiter_next
 isc_interval_iszero
 isc_interval_set
+isc_key_create\r
+isc_key_destroy\r
+isc_key_getspecific\r
+isc_key_setspecific\r
 isc_keyboard_canceled
 isc_keyboard_close
 isc_keyboard_getchar
index 4f1adde6d1743d6694971491358b2895b7666cd7..b1944f66b822c908772499529a141dd87670f489 100644 (file)
@@ -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.18.18.1 2005/09/09 12:31:53 marka Exp $ */
 
 #include <config.h>
 
@@ -66,3 +66,26 @@ isc_thread_setconcurrency(unsigned int level) {
         * call exists
         */
 }
+\r
+void *\r
+isc_key_getspecific(isc_thread_key_t key) {\r
+       return(TlsGetValue(key));\r
+}\r
+\r
+int\r
+isc_key_setspecific(isc_thread_key_t key, void *value) {\r
+       return (TlsSetValue(key, value) ? 0 : GetLastError());\r
+}\r
+\r
+int\r
+isc_key_create(isc_thread_key_t *key, void (*func)(void *)) {\r
+       *key = TlsAlloc();\r
+\r
+       return ((*key == -1) ? 0 : GetLastError());\r
+}\r
+\r
+int\r
+isc_key_destroy(isc_thread_key_t key) {\r
+       return (TlsFree(key) ? 0 : GetLastError());\r
+}\r
+                       
\ No newline at end of file