From: Ondřej Surý Date: Mon, 2 Dec 2019 10:42:50 +0000 (+0100) Subject: Remove isc_thread_key API in favor of ISC_THREAD_LOCAL variables X-Git-Tag: v9.15.7~39^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b1a7ec7481e619c8b38bf592c11fb72191b54665;p=thirdparty%2Fbind9.git Remove isc_thread_key API in favor of ISC_THREAD_LOCAL variables 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. --- diff --git a/lib/isc/pthreads/include/isc/thread.h b/lib/isc/pthreads/include/isc/thread.h index ac50cce0fd4..4f4d592ef51 100644 --- a/lib/isc/pthreads/include/isc/thread.h +++ b/lib/isc/pthreads/include/isc/thread.h @@ -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 ***/ diff --git a/lib/isc/win32/include/isc/thread.h b/lib/isc/win32/include/isc/thread.h index 05225f90167..844c30e9761 100644 --- a/lib/isc/win32/include/isc/thread.h +++ b/lib/isc/win32/include/isc/thread.h @@ -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 diff --git a/lib/isc/win32/libisc.def.in b/lib/isc/win32/libisc.def.in index e65855f187d..129f84b2538 100644 --- a/lib/isc/win32/libisc.def.in +++ b/lib/isc/win32/libisc.def.in @@ -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 diff --git a/lib/isc/win32/thread.c b/lib/isc/win32/thread.c index 6917f9c4648..22722b07dec 100644 --- a/lib/isc/win32/thread.c +++ b/lib/isc/win32/thread.c @@ -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()); -}