From 088906b0641e48c704c5cd529f620023616f561f Mon Sep 17 00:00:00 2001 From: Derrell Lipman Date: Wed, 13 May 2009 14:31:40 -0400 Subject: Make the thread functions a bit easier to use - Create separate macros for lock and unlock so that it's easier to identify which request is being made. - Initialize *ponce in the SMB_THREAD_ONCE macro in the non-thread-safe case, rather than requiring each init function to determine if it's in the non-thread-safe case and manually initialize. Derrell --- lib/util/smb_threads_internal.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'lib/util/smb_threads_internal.h') diff --git a/lib/util/smb_threads_internal.h b/lib/util/smb_threads_internal.h index 038c584b60..afd7559f3b 100644 --- a/lib/util/smb_threads_internal.h +++ b/lib/util/smb_threads_internal.h @@ -30,15 +30,21 @@ }; \ } while (0) -#define SMB_THREAD_LOCK(plock, type) \ - (global_tfp ? global_tfp->lock_mutex((plock), (type), __location__) : 0) +#define SMB_THREAD_LOCK_INTERNAL(plock, type, location) \ + (global_tfp ? global_tfp->lock_mutex((plock), (type), location) : 0) + +#define SMB_THREAD_LOCK(plock) \ + SMB_THREAD_LOCK_INTERNAL(plock, SMB_THREAD_LOCK, __location__) + +#define SMB_THREAD_UNLOCK(plock) \ + SMB_THREAD_LOCK_INTERNAL(plock, SMB_THREAD_UNLOCK, __location__) #define SMB_THREAD_ONCE(ponce, init_fn, pdata) \ (global_tfp \ ? (! *(ponce) \ ? smb_thread_once((ponce), (init_fn), (pdata)) \ : 0) \ - : ((init_fn(pdata)), 0)) + : ((init_fn(pdata)), *(ponce) = true, 1)) #define SMB_THREAD_CREATE_TLS(keyname, key) \ (global_tfp ? global_tfp->create_tls((keyname), &(key), __location__) : 0) -- cgit