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

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Mon Apr 14 11:43:59 PDT 2008


Author: lennart
Date: Mon Apr 14 20:43:59 2008
New Revision: 2265

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=2265&root=pulseaudio&view=rev
Log:
make sure to clear all queued RT signals before arm a new timer

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=2265&root=pulseaudio&r1=2264&r2=2265&view=diff
==============================================================================
--- branches/glitch-free/src/pulsecore/rtpoll.c (original)
+++ branches/glitch-free/src/pulsecore/rtpoll.c Mon Apr 14 20:43:59 2008
@@ -462,9 +462,22 @@
 
         if (p->timer != (timer_t) -1) {
             struct itimerspec its;
+            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);
+
+            /* And install the new timer */
             if (p->timer_enabled) {
+                memset(&its, 0, sizeof(its));
+
                 its.it_value.tv_sec = p->next_elapse.tv_sec;
                 its.it_value.tv_nsec = p->next_elapse.tv_usec*1000;
 
@@ -472,9 +485,8 @@
                  * "disarming" */
                 if (its.it_value.tv_sec == 0 && its.it_value.tv_nsec == 0)
                     its.it_value.tv_nsec = 1;
+                pa_assert_se(timer_settime(p->timer, TIMER_ABSTIME, &its, NULL) == 0);
             }
-
-            pa_assert_se(timer_settime(p->timer, TIMER_ABSTIME, &its, NULL) == 0);
         }
 
 #ifdef __linux__




More information about the pulseaudio-commits mailing list