]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Remove isc_thread_key API in favor of ISC_THREAD_LOCAL variables
authorOndřej Surý <ondrej@isc.org>
Mon, 2 Dec 2019 10:42:50 +0000 (11:42 +0100)
committerOndřej Surý <ondrej@isc.org>
Wed, 4 Dec 2019 13:17:19 +0000 (14:17 +0100)
For BIND 9.16+, TLS aware compiler is required, and using
ISC_THREAD_LOCAL is preferred way of using Thread Local Storage.  The
isc_thread_key API is no longer used anywhere and hence was removed from
BIND 9.

lib/isc/pthreads/include/isc/thread.h
lib/isc/win32/include/isc/thread.h
lib/isc/win32/libisc.def.in
lib/isc/win32/thread.c

index ac50cce0fd4193a0f00615d416d6b83e1d00833c..4f4d592ef518da9acaf6b143a59d3001a01c5a68 100644 (file)
@@ -30,7 +30,6 @@ typedef pthread_t isc_thread_t;
 typedef void * isc_threadresult_t;
 typedef void * isc_threadarg_t;
 typedef isc_threadresult_t (*isc_threadfunc_t)(isc_threadarg_t);
-typedef pthread_key_t isc_thread_key_t;
 
 void
 isc_thread_create(isc_threadfunc_t, isc_threadarg_t, isc_thread_t *);
@@ -53,11 +52,6 @@ isc_thread_setaffinity(int cpu);
 #define isc_thread_self \
        (unsigned long)pthread_self
 
-#define isc_thread_key_create pthread_key_create
-#define isc_thread_key_getspecific pthread_getspecific
-#define isc_thread_key_setspecific pthread_setspecific
-#define isc_thread_key_delete pthread_key_delete
-
 /***
  *** Thread-Local Storage
  ***/
index 05225f901676d722ca400149d7739af65e371e3a..844c30e9761eef56aa381548190f590f2bec31f0 100644 (file)
@@ -61,7 +61,6 @@ typedef HANDLE isc_thread_t;
 typedef DWORD 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,18 +81,6 @@ isc_thread_setname(isc_thread_t, const char *);
 isc_result_t
 isc_thread_setaffinity(int cpu);
 
-int
-isc_thread_key_create(isc_thread_key_t *key, void (*func)(void *));
-
-int
-isc_thread_key_delete(isc_thread_key_t key);
-
-void *
-isc_thread_key_getspecific(isc_thread_key_t);
-
-int
-isc_thread_key_setspecific(isc_thread_key_t key, void *value);
-
 #define isc_thread_yield() Sleep(0)
 
 #if HAVE___DECLSPEC_THREAD
index e65855f187db7d64f31513b24a16913dc9424b7e..129f84b25388dbe61f76617d4a95f7fee2a4bdcf 100644 (file)
@@ -651,10 +651,6 @@ isc_taskpool_setprivilege
 isc_taskpool_size
 isc_thread_create
 isc_thread_join
-isc_thread_key_create
-isc_thread_key_delete
-isc_thread_key_getspecific
-isc_thread_key_setspecific
 isc_thread_setaffinity
 isc_thread_setconcurrency
 isc_thread_setname
index 6917f9c46484fb4371856ac5eb49dfb607693c4a..22722b07dec9a417e20c954e251036d686328ed9 100644 (file)
@@ -73,25 +73,3 @@ isc_thread_setaffinity(int cpu) {
        /* no-op on Windows for now */
        return (ISC_R_SUCCESS);
 }
-
-void *
-isc_thread_key_getspecific(isc_thread_key_t key) {
-       return(TlsGetValue(key));
-}
-
-int
-isc_thread_key_setspecific(isc_thread_key_t key, void *value) {
-       return (TlsSetValue(key, value) ? 0 : GetLastError());
-}
-
-int
-isc_thread_key_create(isc_thread_key_t *key, void (*func)(void *)) {
-       *key = TlsAlloc();
-
-       return ((*key != -1) ? 0 : GetLastError());
-}
-
-int
-isc_thread_key_delete(isc_thread_key_t key) {
-       return (TlsFree(key) ? 0 : GetLastError());
-}