[pulseaudio-commits] r1863 - in /branches/lennart/src/pulsecore: rtpoll.c rtpoll.h

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Tue Sep 18 16:21:07 PDT 2007


Author: lennart
Date: Wed Sep 19 01:21:06 2007
New Revision: 1863

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=1863&root=pulseaudio&view=rev
Log:
make use of pa_bool_t on a few places where applicable; really start work_cb

Modified:
    branches/lennart/src/pulsecore/rtpoll.c
    branches/lennart/src/pulsecore/rtpoll.h

Modified: branches/lennart/src/pulsecore/rtpoll.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/rtpoll.c?rev=1863&root=pulseaudio&r1=1862&r2=1863&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/rtpoll.c (original)
+++ branches/lennart/src/pulsecore/rtpoll.c Wed Sep 19 01:21:06 2007
@@ -49,19 +49,19 @@
     struct pollfd *pollfd, *pollfd2;
     unsigned n_pollfd_alloc, n_pollfd_used;
 
-    int timer_enabled;
+    pa_bool_t timer_enabled;
     struct timespec next_elapse;
     pa_usec_t period;
 
-    int scan_for_dead;
-    int running, installed, rebuild_needed, quit;
+    pa_bool_t scan_for_dead;
+    pa_bool_t running, installed, rebuild_needed, quit;
 
 #ifdef HAVE_PPOLL
     int rtsig;
     sigset_t sigset_unblocked;
     timer_t timer;
 #ifdef __linux__
-    int dont_use_ppoll;
+    pa_bool_t dont_use_ppoll;
 #endif    
 #endif
     
@@ -70,7 +70,7 @@
 
 struct pa_rtpoll_item {
     pa_rtpoll *rtpoll;
-    int dead;
+    pa_bool_t dead;
 
     pa_rtpoll_priority_t priority;
 
@@ -98,9 +98,8 @@
 
 #ifdef __linux__
     /* ppoll is broken on Linux < 2.6.16 */
-    
-    p->dont_use_ppoll = 0;
-
+    p->dont_use_ppoll = FALSE;
+    
     {
         struct utsname u;
         unsigned major, minor, micro;
@@ -112,7 +111,7 @@
             (major == 2 && minor < 6) ||
             (major == 2 && minor == 6 && micro < 16))
 
-            p->dont_use_ppoll = 1;
+            p->dont_use_ppoll = TRUE;
     }
 
 #endif
@@ -130,13 +129,13 @@
 
     p->period = 0;
     memset(&p->next_elapse, 0, sizeof(p->next_elapse));
-    p->timer_enabled = 0;
-
-    p->running = 0;
-    p->installed = 0;
-    p->scan_for_dead = 0;
-    p->rebuild_needed = 0;
-    p->quit = 0;
+    p->timer_enabled = FALSE;
+
+    p->running = FALSE;
+    p->installed = FALSE;
+    p->scan_for_dead = FALSE;
+    p->rebuild_needed = FALSE;
+    p->quit = FALSE;
     
     PA_LLIST_HEAD_INIT(pa_rtpoll_item, p->items);
 
@@ -189,7 +188,7 @@
     
     pa_assert(p);
 
-    p->rebuild_needed = 0;
+    p->rebuild_needed = FALSE;
 
     if (p->n_pollfd_used > p->n_pollfd_alloc) {
         /* Hmm, we have to allocate some more space */
@@ -241,7 +240,7 @@
     if (pa_flist_push(PA_STATIC_FLIST_GET(items), i) < 0)
         pa_xfree(i);
 
-    p->rebuild_needed = 1;
+    p->rebuild_needed = TRUE;
 }
 
 void pa_rtpoll_free(pa_rtpoll *p) {
@@ -288,7 +287,7 @@
     }
 }
 
-int pa_rtpoll_run(pa_rtpoll *p, int wait) {
+int pa_rtpoll_run(pa_rtpoll *p, pa_bool_t wait) {
     pa_rtpoll_item *i;
     int r = 0;
     struct timespec timeout;
@@ -297,7 +296,7 @@
     pa_assert(!p->running);
     pa_assert(p->installed);
     
-    p->running = 1;
+    p->running = TRUE;
 
     /* First, let's do some work */
     for (i = p->items; i && i->priority < PA_RTPOLL_NEVER; i = i->next) {
@@ -306,7 +305,7 @@
         if (i->dead)
             continue;
         
-        if (!i->before_cb)
+        if (!i->work_cb)
             continue;
 
         if (p->quit)
@@ -422,12 +421,12 @@
 
 finish:
 
-    p->running = 0;
+    p->running = FALSE;
         
     if (p->scan_for_dead) {
         pa_rtpoll_item *n;
 
-        p->scan_for_dead = 0;
+        p->scan_for_dead = FALSE;
         
         for (i = p->items; i; i = n) {
             n = i->next;
@@ -495,7 +494,7 @@
     
     p->next_elapse = *ts;
     p->period = 0;
-    p->timer_enabled = 1;
+    p->timer_enabled = TRUE;
     
     update_timer(p);
 }
@@ -506,7 +505,7 @@
     p->period = usec;
     pa_rtclock_get(&p->next_elapse);
     pa_timespec_add(&p->next_elapse, usec);
-    p->timer_enabled = 1;
+    p->timer_enabled = TRUE;
 
     update_timer(p);
 }
@@ -517,7 +516,7 @@
     p->period = 0;
     pa_rtclock_get(&p->next_elapse);
     pa_timespec_add(&p->next_elapse, usec);
-    p->timer_enabled = 1;
+    p->timer_enabled = TRUE;
 
     update_timer(p);
 }
@@ -527,7 +526,7 @@
 
     p->period = 0;
     memset(&p->next_elapse, 0, sizeof(p->next_elapse));
-    p->timer_enabled = 0;
+    p->timer_enabled = FALSE;
 
     update_timer(p);
 }
@@ -541,7 +540,7 @@
         i = pa_xnew(pa_rtpoll_item, 1);
 
     i->rtpoll = p;
-    i->dead = 0;
+    i->dead = FALSE;
     i->n_pollfd = n_fds;
     i->pollfd = NULL;
     i->priority = prio;
@@ -572,8 +571,8 @@
     pa_assert(i);
 
     if (i->rtpoll->running) {
-        i->dead = 1;
-        i->rtpoll->scan_for_dead = 1;
+        i->dead = TRUE;
+        i->rtpoll->scan_for_dead = TRUE;
         return;
     }
 
@@ -728,5 +727,5 @@
 void pa_rtpoll_quit(pa_rtpoll *p) {
     pa_assert(p);
 
-    p->quit = 1;
-}
+    p->quit = TRUE;
+}

Modified: branches/lennart/src/pulsecore/rtpoll.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/rtpoll.h?rev=1863&root=pulseaudio&r1=1862&r2=1863&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/rtpoll.h (original)
+++ branches/lennart/src/pulsecore/rtpoll.h Wed Sep 19 01:21:06 2007
@@ -31,6 +31,7 @@
 #include <pulse/sample.h>
 #include <pulsecore/asyncmsgq.h>
 #include <pulsecore/fdsem.h>
+#include <pulsecore/macro.h>
 
 /* An implementation of a "real-time" poll loop. Basically, this is
  * yet another wrapper around poll(). However it has certain
@@ -72,7 +73,7 @@
  * struct pollfd. Returns negative on error, positive if the loop
  * should continue to run, 0 when the loop should be terminated
  * cleanly. */
-int pa_rtpoll_run(pa_rtpoll *f, int wait);
+int pa_rtpoll_run(pa_rtpoll *f, pa_bool_t 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);




More information about the pulseaudio-commits mailing list