[pulseaudio-commits] r1913 - /branches/lennart/src/pulsecore/rtsig.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Fri Sep 28 05:52:47 PDT 2007


Author: lennart
Date: Fri Sep 28 14:52:47 2007
New Revision: 1913

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=1913&root=pulseaudio&view=rev
Log:
Allocate rtsigs from back to front, to avoid clashes with other libraries makeing use of rtsigs

Modified:
    branches/lennart/src/pulsecore/rtsig.c

Modified: branches/lennart/src/pulsecore/rtsig.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/rtsig.c?rev=1913&root=pulseaudio&r1=1912&r2=1913&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/rtsig.c (original)
+++ branches/lennart/src/pulsecore/rtsig.c Fri Sep 28 14:52:47 2007
@@ -50,17 +50,17 @@
 int pa_rtsig_get(void) {
     void *p;
     int sig;
-    
+
     if ((p = pa_flist_pop(PA_STATIC_FLIST_GET(rtsig_flist))))
         return PA_PTR_TO_INT(p);
 
-    sig = pa_atomic_inc(&rtsig_current);
+    sig = pa_atomic_dec(&rtsig_current);
 
-    pa_assert(sig >= SIGRTMIN);
-    pa_assert(sig >= rtsig_start);
-    
-    if (sig > rtsig_end) {
-        pa_atomic_dec(&rtsig_current);
+    pa_assert(sig <= SIGRTMAX);
+    pa_assert(sig <= rtsig_end);
+
+    if (sig < rtsig_start) {
+        pa_atomic_inc(&rtsig_current);
         return -1;
     }
 
@@ -73,7 +73,7 @@
 
     if ((p = PA_STATIC_TLS_GET(rtsig_tls)))
         return PA_PTR_TO_INT(p);
-    
+
     if ((sig = pa_rtsig_get()) < 0)
         return -1;
 
@@ -102,11 +102,12 @@
     rtsig_end = end;
 
     sigemptyset(&ss);
-    
+
     for (s = rtsig_start; s <= rtsig_end; s++)
         pa_assert_se(sigaddset(&ss, s) == 0);
-    
+
     pa_assert(pthread_sigmask(SIG_BLOCK, &ss, NULL) == 0);
-    
-    pa_atomic_store(&rtsig_current, rtsig_start);
+
+    /* We allocate starting from the end */
+    pa_atomic_store(&rtsig_current, rtsig_end);
 }




More information about the pulseaudio-commits mailing list