[pulseaudio-commits] r1803 - in /branches/lennart/src: modules/ pulsecore/ tests/

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Tue Sep 11 06:15:40 PDT 2007


Author: lennart
Date: Tue Sep 11 15:15:39 2007
New Revision: 1803

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=1803&root=pulseaudio&view=rev
Log:
add 'wait' parameter to pa_rtpoll_run(), if zero pa_rtpoll_runn will only update the struct pollfd but not wait for an event

Modified:
    branches/lennart/src/modules/module-alsa-sink.c
    branches/lennart/src/modules/module-alsa-source.c
    branches/lennart/src/modules/module-combine.c
    branches/lennart/src/modules/module-null-sink.c
    branches/lennart/src/modules/module-oss.c
    branches/lennart/src/modules/module-pipe-sink.c
    branches/lennart/src/modules/module-pipe-source.c
    branches/lennart/src/pulsecore/rtpoll.c
    branches/lennart/src/pulsecore/rtpoll.h
    branches/lennart/src/tests/rtpoll-test.c

Modified: branches/lennart/src/modules/module-alsa-sink.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/module-alsa-sink.c?rev=1803&root=pulseaudio&r1=1802&r2=1803&view=diff
==============================================================================
--- branches/lennart/src/modules/module-alsa-sink.c (original)
+++ branches/lennart/src/modules/module-alsa-sink.c Tue Sep 11 15:15:39 2007
@@ -643,7 +643,7 @@
             continue;
         
         /* Hmm, nothing to do. Let's sleep */
-        if (pa_rtpoll_run(u->rtpoll) < 0) {
+        if (pa_rtpoll_run(u->rtpoll, 1) < 0) {
             pa_log("poll() failed: %s", pa_cstrerror(errno));
             goto fail;
         }

Modified: branches/lennart/src/modules/module-alsa-source.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/module-alsa-source.c?rev=1803&root=pulseaudio&r1=1802&r2=1803&view=diff
==============================================================================
--- branches/lennart/src/modules/module-alsa-source.c (original)
+++ branches/lennart/src/modules/module-alsa-source.c Tue Sep 11 15:15:39 2007
@@ -626,7 +626,7 @@
             continue;
 
         /* Hmm, nothing to do. Let's sleep */
-        if (pa_rtpoll_run(u->rtpoll) < 0) {
+        if (pa_rtpoll_run(u->rtpoll, 1) < 0) {
             pa_log("poll() failed: %s", pa_cstrerror(errno));
             goto fail;
         }

Modified: branches/lennart/src/modules/module-combine.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/module-combine.c?rev=1803&root=pulseaudio&r1=1802&r2=1803&view=diff
==============================================================================
--- branches/lennart/src/modules/module-combine.c (original)
+++ branches/lennart/src/modules/module-combine.c Tue Sep 11 15:15:39 2007
@@ -268,7 +268,7 @@
             continue;
 
         /* Hmm, nothing to do. Let's sleep */
-        if (pa_rtpoll_run(u->rtpoll) < 0) {
+        if (pa_rtpoll_run(u->rtpoll, 1) < 0) {
             pa_log("poll() failed: %s", pa_cstrerror(errno));
             goto fail;
         }

Modified: branches/lennart/src/modules/module-null-sink.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/module-null-sink.c?rev=1803&root=pulseaudio&r1=1802&r2=1803&view=diff
==============================================================================
--- branches/lennart/src/modules/module-null-sink.c (original)
+++ branches/lennart/src/modules/module-null-sink.c Tue Sep 11 15:15:39 2007
@@ -158,7 +158,7 @@
             continue;
 
         /* Hmm, nothing to do. Let's sleep */
-        if (pa_rtpoll_run(u->rtpoll) < 0) {
+        if (pa_rtpoll_run(u->rtpoll, 1) < 0) {
             pa_log("poll() failed: %s", pa_cstrerror(errno));
             goto fail;
         }

Modified: branches/lennart/src/modules/module-oss.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/module-oss.c?rev=1803&root=pulseaudio&r1=1802&r2=1803&view=diff
==============================================================================
--- branches/lennart/src/modules/module-oss.c (original)
+++ branches/lennart/src/modules/module-oss.c Tue Sep 11 15:15:39 2007
@@ -1031,7 +1031,7 @@
         }
         
         /* Hmm, nothing to do. Let's sleep */
-        if (pa_rtpoll_run(u->rtpoll) < 0) {
+        if (pa_rtpoll_run(u->rtpoll, 1) < 0) {
             pa_log("poll() failed: %s", pa_cstrerror(errno));
             goto fail;
         }

Modified: branches/lennart/src/modules/module-pipe-sink.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/module-pipe-sink.c?rev=1803&root=pulseaudio&r1=1802&r2=1803&view=diff
==============================================================================
--- branches/lennart/src/modules/module-pipe-sink.c (original)
+++ branches/lennart/src/modules/module-pipe-sink.c Tue Sep 11 15:15:39 2007
@@ -185,7 +185,7 @@
         /* Hmm, nothing to do. Let's sleep */
         pollfd->events = u->sink->thread_info.state == PA_SINK_RUNNING ? POLLOUT : 0;
 
-        if (pa_rtpoll_run(u->rtpoll) < 0) {
+        if (pa_rtpoll_run(u->rtpoll, 1) < 0) {
             pa_log("poll() failed: %s", pa_cstrerror(errno));
             goto fail;
         }

Modified: branches/lennart/src/modules/module-pipe-source.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/module-pipe-source.c?rev=1803&root=pulseaudio&r1=1802&r2=1803&view=diff
==============================================================================
--- branches/lennart/src/modules/module-pipe-source.c (original)
+++ branches/lennart/src/modules/module-pipe-source.c Tue Sep 11 15:15:39 2007
@@ -164,7 +164,7 @@
         /* Hmm, nothing to do. Let's sleep */
         pollfd->events = u->source->thread_info.state == PA_SOURCE_RUNNING ? POLLIN : 0;
 
-        if (pa_rtpoll_run(u->rtpoll) < 0) {
+        if (pa_rtpoll_run(u->rtpoll, 1) < 0) {
             pa_log("poll() failed: %s", pa_cstrerror(errno));
             goto fail;
         }

Modified: branches/lennart/src/pulsecore/rtpoll.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/rtpoll.c?rev=1803&root=pulseaudio&r1=1802&r2=1803&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/rtpoll.c (original)
+++ branches/lennart/src/pulsecore/rtpoll.c Tue Sep 11 15:15:39 2007
@@ -257,7 +257,7 @@
     pa_xfree(p);
 }
 
-int pa_rtpoll_run(pa_rtpoll *p) {
+int pa_rtpoll_run(pa_rtpoll *p, int wait) {
     pa_rtpoll_item *i;
     int r = 0;
     int no_events = 0;
@@ -301,7 +301,10 @@
         rtpoll_rebuild(p);
 
     /* Calculate timeout */
-    if (p->timer_enabled) {
+    if (!wait) {
+        timeout.tv_sec = 0;
+        timeout.tv_nsec = 0;
+    } else if (p->timer_enabled) {
         struct timespec now;
         pa_rtclock_get(&now);
 

Modified: branches/lennart/src/pulsecore/rtpoll.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/rtpoll.h?rev=1803&root=pulseaudio&r1=1802&r2=1803&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/rtpoll.h (original)
+++ branches/lennart/src/pulsecore/rtpoll.h Tue Sep 11 15:15:39 2007
@@ -58,7 +58,10 @@
 
 void pa_rtpoll_install(pa_rtpoll *p);
 
-int pa_rtpoll_run(pa_rtpoll *f);
+/* Sleep on the rtpoll until the time event, or any of the fd events
+ * is triggered. If "wait" is 0 we don't sleep but only update the
+ * struct pollfd. */
+int pa_rtpoll_run(pa_rtpoll *f, int wait);
 
 void pa_rtpoll_set_timer_absolute(pa_rtpoll *p, const struct timespec *ts);
 void pa_rtpoll_set_timer_periodic(pa_rtpoll *p, pa_usec_t usec);

Modified: branches/lennart/src/tests/rtpoll-test.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/tests/rtpoll-test.c?rev=1803&root=pulseaudio&r1=1802&r2=1803&view=diff
==============================================================================
--- branches/lennart/src/tests/rtpoll-test.c (original)
+++ branches/lennart/src/tests/rtpoll-test.c Tue Sep 11 15:15:39 2007
@@ -58,7 +58,7 @@
     pa_rtpoll_install(p);
     pa_rtpoll_set_timer_periodic(p, 10000000); /* 10 s */
 
-    pa_rtpoll_run(p);
+    pa_rtpoll_run(p, 1);
     
     pa_rtpoll_item_free(i);
     
@@ -70,7 +70,7 @@
     pollfd->fd = 0;
     pollfd->events = POLLIN;
     
-    pa_rtpoll_run(p);
+    pa_rtpoll_run(p, 1);
 
     pa_rtpoll_item_free(i);
     




More information about the pulseaudio-commits mailing list