[pulseaudio-commits] r2296 - /branches/glitch-free/src/pulsecore/rtpoll.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Mon Apr 21 19:47:06 PDT 2008


Author: lennart
Date: Tue Apr 22 04:47:05 2008
New Revision: 2296

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=2296&root=pulseaudio&view=rev
Log:
if no timer was armed, we don't need to disarm it

Modified:
    branches/glitch-free/src/pulsecore/rtpoll.c

Modified: branches/glitch-free/src/pulsecore/rtpoll.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/glitch-free/src/pulsecore/rtpoll.c?rev=2296&root=pulseaudio&r1=2295&r2=2296&view=diff
==============================================================================
--- branches/glitch-free/src/pulsecore/rtpoll.c (original)
+++ branches/glitch-free/src/pulsecore/rtpoll.c Tue Apr 22 04:47:05 2008
@@ -71,6 +71,7 @@
     int rtsig;
     sigset_t sigset_unblocked;
     timer_t timer;
+    pa_bool_t timer_armed;
 #ifdef __linux__
     pa_bool_t dont_use_ppoll;
 #endif
@@ -130,6 +131,7 @@
     p->rtsig = -1;
     sigemptyset(&p->sigset_unblocked);
     p->timer = (timer_t) -1;
+    p->timer_armed = FALSE;
 
 #endif
 
@@ -465,14 +467,16 @@
             struct timespec ts = { .tv_sec = 0, .tv_nsec = 0 };
             sigset_t ss;
 
-            /* First disarm timer */
-            memset(&its, 0, sizeof(its));
-            pa_assert_se(timer_settime(p->timer, TIMER_ABSTIME, &its, NULL) == 0);
-
-            /* Remove a signal that might be waiting in the signal q */
-            pa_assert_se(sigemptyset(&ss) == 0);
-            pa_assert_se(sigaddset(&ss, p->rtsig) == 0);
-            sigtimedwait(&ss, NULL, &ts);
+            if (p->timer_armed) {
+                /* First disarm timer */
+                memset(&its, 0, sizeof(its));
+                pa_assert_se(timer_settime(p->timer, TIMER_ABSTIME, &its, NULL) == 0);
+
+                /* Remove a signal that might be waiting in the signal q */
+                pa_assert_se(sigemptyset(&ss) == 0);
+                pa_assert_se(sigaddset(&ss, p->rtsig) == 0);
+                sigtimedwait(&ss, NULL, &ts);
+            }
 
             /* And install the new timer */
             if (p->timer_enabled) {
@@ -487,6 +491,8 @@
                     its.it_value.tv_nsec = 1;
                 pa_assert_se(timer_settime(p->timer, TIMER_ABSTIME, &its, NULL) == 0);
             }
+
+            p->timer_armed = p->timer_enabled;
         }
 
 #ifdef __linux__




More information about the pulseaudio-commits mailing list