summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2009-04-20 04:00:06 -0700
committerJeremy Allison <jra@samba.org>2009-04-20 04:00:06 -0700
commit399c765538d91c696efd1496fffd9ae1e876f3ae (patch)
treea8fc0b6f3a9f34b3d2e7d33fce9906a160a9324b
parent3d2e95c296a1858986b9c806dff67c9cc3d8f70d (diff)
downloadsamba-399c765538d91c696efd1496fffd9ae1e876f3ae.tar.gz
samba-399c765538d91c696efd1496fffd9ae1e876f3ae.tar.bz2
samba-399c765538d91c696efd1496fffd9ae1e876f3ae.zip
Attempt to fix build farm on platforms where pthread_once_t is a struct.
Jeremy.
-rw-r--r--lib/util/smb_threads.h5
-rw-r--r--lib/util/talloc_stack.c4
2 files changed, 6 insertions, 3 deletions
diff --git a/lib/util/smb_threads.h b/lib/util/smb_threads.h
index f4ed1fcb9a..682e142c5b 100644
--- a/lib/util/smb_threads.h
+++ b/lib/util/smb_threads.h
@@ -33,8 +33,11 @@
#if defined(HAVE_PTHREAD_H)
#define SMB_THREAD_ONCE_INIT PTHREAD_ONCE_INIT
+#define SMB_THREAD_ONCE_IS_INITIALIZED(val) (true)
+#define SMB_THREAD_ONCE_INITIALIZE(val)
#else
-#define SMB_THREAD_ONCE_INIT false
+#define SMB_THREAD_ONCE_IS_INITIALIZED(val) ((val) == true)
+#define SMB_THREAD_ONCE_INITIALIZE(val) ((val) = true)
#endif
enum smb_thread_lock_type {
diff --git a/lib/util/talloc_stack.c b/lib/util/talloc_stack.c
index f5ca9d21d5..2ed18fa113 100644
--- a/lib/util/talloc_stack.c
+++ b/lib/util/talloc_stack.c
@@ -62,10 +62,10 @@ static void talloc_stackframe_init(void)
{
if (!global_tfp) {
/* Non-thread safe init case. */
- if (ts_initialized) {
+ if (SMB_THREAD_ONCE_IS_INITIALIZED(ts_initialized)) {
return;
}
- ts_initialized = true;
+ SMB_THREAD_ONCE_INITIALIZE(ts_initialized);
}
if (SMB_THREAD_CREATE_TLS("talloc_stackframe", global_ts)) {