[PATCH 3/5] mainloop: Remove redundant wakeup_pipe validity checks.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The pipe is opened when creating the mainloop and closed
when freeing the mainloop. The pipe fds can never be less
than zero.
---
 src/pulse/mainloop.c |   17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/src/pulse/mainloop.c b/src/pulse/mainloop.c
index 53ff7af..160ba9c 100644
--- a/src/pulse/mainloop.c
+++ b/src/pulse/mainloop.c
@@ -615,13 +615,11 @@ static void rebuild_pollfds(pa_mainloop *m) {
     m->n_pollfds = 0;
     p = m->pollfds;
 
-    if (m->wakeup_pipe[0] >= 0) {
-        m->pollfds[0].fd = m->wakeup_pipe[0];
-        m->pollfds[0].events = POLLIN;
-        m->pollfds[0].revents = 0;
-        p++;
-        m->n_pollfds++;
-    }
+    m->pollfds[0].fd = m->wakeup_pipe[0];
+    m->pollfds[0].events = POLLIN;
+    m->pollfds[0].revents = 0;
+    p++;
+    m->n_pollfds++;
 
     PA_LLIST_FOREACH(e, m->io_events) {
         if (e->dead) {
@@ -776,7 +774,7 @@ void pa_mainloop_wakeup(pa_mainloop *m) {
     char c = 'W';
     pa_assert(m);
 
-    if (m->wakeup_pipe[1] >= 0 && m->state == STATE_POLLING) {
+    if (m->state == STATE_POLLING) {
         pa_write(m->wakeup_pipe[1], &c, sizeof(c), &m->wakeup_pipe_type);
         pa_atomic_store(&m->wakeup_requested, TRUE);
     }
@@ -787,9 +785,6 @@ static void clear_wakeup(pa_mainloop *m) {
 
     pa_assert(m);
 
-    if (m->wakeup_pipe[0] < 0)
-        return;
-
     if (pa_atomic_cmpxchg(&m->wakeup_requested, TRUE, FALSE)) {
         while (pa_read(m->wakeup_pipe[0], &c, sizeof(c), &m->wakeup_pipe_type) == sizeof(c))
             ;
-- 
1.7.8



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux