[pulseaudio-commits] r1349 - /trunk/src/pulsecore/thread-posix.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Wed Aug 30 10:12:37 PDT 2006


Author: lennart
Date: Wed Aug 30 19:12:35 2006
New Revision: 1349

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=1349&root=pulseaudio&view=rev
Log:
fix handling of "running" variable

Modified:
    trunk/src/pulsecore/thread-posix.c

Modified: trunk/src/pulsecore/thread-posix.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/pulsecore/thread-posix.c?rev=1349&root=pulseaudio&r1=1348&r2=1349&view=diff
==============================================================================
--- trunk/src/pulsecore/thread-posix.c (original)
+++ trunk/src/pulsecore/thread-posix.c Wed Aug 30 19:12:35 2006
@@ -66,9 +66,9 @@
     ASSERT_SUCCESS(pthread_once(&thread_tls_once, thread_tls_once_func));
     pa_tls_set(thread_tls, t);
     
-    AO_store_release_write(&t->running, 1);
+    AO_fetch_and_add1_full(&t->running);
     t->thread_func(t->userdata);
-    AO_store_release_write(&t->running, 0);
+    AO_fetch_and_add_full(&t->running, (AO_t) -2);
     
     return NULL;
 }
@@ -79,19 +79,24 @@
     t = pa_xnew(pa_thread, 1);
     t->thread_func = thread_func;
     t->userdata = userdata;
+    AO_store_full(&t->running, 0);
 
     if (pthread_create(&t->id, NULL, internal_thread_func, t) < 0) {
         pa_xfree(t);
         return NULL;
     }
 
+    AO_fetch_and_add1_full(&t->running);
+
     return t;
 }
 
 int pa_thread_is_running(pa_thread *t) {
+    AO_t r;
     assert(t);
 
-    return !!AO_load_acquire_read(&t->running);
+    r = AO_load_full(&t->running);
+    return r == 1 || r == 2;
 }
 
 void pa_thread_free(pa_thread *t) {




More information about the pulseaudio-commits mailing list