diff options
author | Jeremy Allison <jra@samba.org> | 2009-04-14 15:19:39 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2009-04-14 15:19:39 -0700 |
commit | 8e06e945b6b03db825862f2f057f0dfe13ade3a2 (patch) | |
tree | d95c239803eec9626c9da3b16f5bc0c71672b523 /lib/util/smb_threads_internal.h | |
parent | 4721be488ceb8229d564e4b63ca9937603394e51 (diff) | |
download | samba-8e06e945b6b03db825862f2f057f0dfe13ade3a2.tar.gz samba-8e06e945b6b03db825862f2f057f0dfe13ade3a2.tar.bz2 samba-8e06e945b6b03db825862f2f057f0dfe13ade3a2.zip |
Ensure a tls key is only generated once - wrap create & destroy in a mutex.
Change the function names to add _once to the tls_create & tls_destroy to
make this obvious.
Jeremy.
Diffstat (limited to 'lib/util/smb_threads_internal.h')
-rw-r--r-- | lib/util/smb_threads_internal.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/util/smb_threads_internal.h b/lib/util/smb_threads_internal.h index ad05aae9a5..58c6fe3f99 100644 --- a/lib/util/smb_threads_internal.h +++ b/lib/util/smb_threads_internal.h @@ -33,13 +33,13 @@ #define SMB_THREAD_LOCK(plock, type) \ (global_tfp ? global_tfp->lock_mutex((plock), (type), __location__) : 0) -#define SMB_THREAD_CREATE_TLS(keyname, key) \ - (global_tfp ? global_tfp->create_tls((keyname), &(key), __location__) : 0) +#define SMB_THREAD_CREATE_TLS_ONCE(keyname, key) \ + (global_tfp ? global_tfp->create_tls_once((keyname), &(key), __location__) : 0) -#define SMB_THREAD_DESTROY_TLS(key) \ +#define SMB_THREAD_DESTROY_TLS_ONCE(key) \ do { \ if (global_tfp) { \ - global_tfp->destroy_tls(key); \ + global_tfp->destroy_tls_once(&(key), __location__); \ }; \ } while (0) @@ -50,4 +50,12 @@ #define SMB_THREAD_GET_TLS(key) \ (global_tfp ? global_tfp->get_tls((key), __location__) : (key)) +/* + * Global thread lock list. + */ + +#define NUM_GLOBAL_LOCKS 1 + +#define GLOBAL_LOCK(locknum) (global_lock_array ? global_lock_array[(locknum)] : NULL) + #endif |