Fix broken smb_thread_once function (again)
authorDerrell Lipman <derrell@dworkin.(none)>
Wed, 13 May 2009 01:32:33 +0000 (21:32 -0400)
committerDerrell Lipman <derrell@dworkin.(none)>
Wed, 13 May 2009 01:32:33 +0000 (21:32 -0400)
- It would help if smb_thread_once did, eventually, set the variable that
  prevents the init function from being run again. Sigh. It must be getting
  late.

Derrell

lib/util/smb_threads.c

index 6f84a2e7476d78dc82bff6bb5df58fbb6c90ab0c..e2d01f775a4e0e7d09183fa704a2ff6d9001207e 100644 (file)
@@ -121,6 +121,9 @@ int smb_thread_once(smb_thread_once_t *ponce, void (*init_fn)(void))
         if (! *ponce) {
                 /* Nope, we need to run the initialization function */
                 (*init_fn)();
+
+                /* Now we can indicate that the function has been run */
+                *ponce = true;
         }
 
         /* Unlock the mutex */