[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-1531-g9a93dc0

Derrell Lipman derrell at samba.org
Mon May 11 02:59:00 GMT 2009


The branch, master has been updated
       via  9a93dc092c6951cdfa6e05c3885a006e5e56d7d3 (commit)
      from  404327ad41c5f24f9ace5cad31509149d87197fd (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 9a93dc092c6951cdfa6e05c3885a006e5e56d7d3
Author: Derrell Lipman <derrell at dworkin.(none)>
Date:   Sun May 10 22:58:12 2009 -0400

    Optimize smb_thread_once usage by not calling it if known already called
    
    - The macro SMB_THREAD_ONCE now tests whether the "once" variable is already
      set, and if so avoids calling smb_thread_once().
    
    Derrell

-----------------------------------------------------------------------

Summary of changes:
 lib/util/smb_threads_internal.h |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/util/smb_threads_internal.h b/lib/util/smb_threads_internal.h
index 0260934..29a581b 100644
--- a/lib/util/smb_threads_internal.h
+++ b/lib/util/smb_threads_internal.h
@@ -33,8 +33,12 @@
 #define SMB_THREAD_LOCK(plock, type) \
 	(global_tfp ? global_tfp->lock_mutex((plock), (type), __location__) : 0)
 
-#define SMB_THREAD_ONCE(ponce, init_fn) \
-	(global_tfp ? smb_thread_once((ponce), (init_fn)) : ((init_fn()), 0))
+#define SMB_THREAD_ONCE(ponce, init_fn)                 \
+        (global_tfp                                     \
+         ? (! *(ponce)                                  \
+            ? smb_thread_once((ponce), (init_fn))       \
+            : 0)                                        \
+         : ((init_fn()), 0))
 
 #define SMB_THREAD_CREATE_TLS(keyname, key) \
 	(global_tfp ? global_tfp->create_tls((keyname), &(key), __location__) : 0)


-- 
Samba Shared Repository


More information about the samba-cvs mailing list