From pulseaudio-discuss-bounces+tanuk=iki.fi@lists.freedesktop.org Mon Apr 2 08:03:15 2012 Return-Path: Received: from compute1.internal (compute1.nyi.mail.srv.osa [10.202.2.41]) by sloti30d2p3 (Cyrus git2.5+0-git-fastmail-7802) with LMTPA; Mon, 02 Apr 2012 08:03:15 -0400 X-Sieve: CMU Sieve 2.4 X-Spam-score: 0.0 X-Spam-hits: BAYES_00 -1.9, RCVD_IN_DNSWL_MED -2.3, T_RP_MATCHES_RCVD -0.01, BAYES_USED global, SA_VERSION 3.3.1 X-Spam-source: IP='131.252.210.177', Host='gabe.freedesktop.org', Country='US', FromHeader='com', MailFrom='org', XOriginatingCountry='UNK' X-Spam-charsets: plain='us-ascii' X-Resolved-to: tanuk@fastmail.fm X-Delivered-to: tanuk@fastmail.fm X-Mail-from: pulseaudio-discuss-bounces+tanuk=iki.fi@lists.freedesktop.org Received: from mx1.nyi.mail.srv.osa ([10.202.2.200]) by compute1.internal (LMTPProxy); Mon, 02 Apr 2012 08:03:15 -0400 Received: from ikiaikainen.iki.fi (ikiaikainen.iki.fi [212.16.98.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.nyi.mail.srv.osa (Postfix) with ESMTPS id 741C64C008F for ; Mon, 2 Apr 2012 08:03:14 -0400 (EDT) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by ikiaikainen.iki.fi (8.14.5/8.14.4) with ESMTP id q32C397l014690 for ; Mon, 2 Apr 2012 15:03:11 +0300 (EEST) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3FE2FA02B4 for ; Mon, 2 Apr 2012 05:03:09 -0700 (PDT) X-Original-To: pulseaudio-discuss@lists.freedesktop.org X-Remote-Delivered-To: pulseaudio-discuss@lists.freedesktop.org Received: from smtp1.digia.com (smtp1.digia.com [82.118.214.156]) by gabe.freedesktop.org (Postfix) with ESMTP id BCE41A027A for ; Mon, 2 Apr 2012 05:01:26 -0700 (PDT) Received: from smtp1.digia.com (unknown [127.0.0.1]) by IMSVA80 (Postfix) with ESMTP id C1224370057 for ; Mon, 2 Apr 2012 15:01:25 +0300 (EEST) Received: from IT-EXCAS01-HKI.it.local (unknown [10.9.52.70]) by smtp1.digia.com (Postfix) with ESMTP id B41C537003D for ; Mon, 2 Apr 2012 15:01:25 +0300 (EEST) Received: from IT-W2076.it.local (10.120.150.85) by IT-EXCAS01-HKI.it.local (10.9.52.75) with Microsoft SMTP Server id 14.1.355.2; Mon, 2 Apr 2012 15:01:24 +0300 From: Tanu Kaskinen To: Date: Mon, 2 Apr 2012 15:01:04 +0300 Message-ID: <1333368066-32343-4-git-send-email-tanu.kaskinen@digia.com> X-Mailer: git-send-email 1.7.8 In-Reply-To: <1333368066-32343-1-git-send-email-tanu.kaskinen@digia.com> References: <1333368066-32343-1-git-send-email-tanu.kaskinen@digia.com> MIME-Version: 1.0 X-Originating-IP: [10.120.150.85] Subject: [pulseaudio-discuss] [PATCH 3/5] mainloop: Remove redundant wakeup_pipe validity checks. X-BeenThere: pulseaudio-discuss@lists.freedesktop.org X-Mailman-Version: 2.1.11 Precedence: list Reply-To: General PulseAudio Discussion List-Id: General PulseAudio Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Sender: pulseaudio-discuss-bounces+tanuk=iki.fi@lists.freedesktop.org Errors-To: pulseaudio-discuss-bounces+tanuk=iki.fi@lists.freedesktop.org X-Truedomain-Domain: digia.com X-Truedomain-SPF: No Record X-Truedomain-DKIM: No Signature X-Truedomain-ID: A1A51180FCAA009EADB1924F07CC7A27 X-Truedomain: Neutral X-Evolution-Source: 1322389393.6514.21@laptop Content-Transfer-Encoding: 8bit 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 _______________________________________________ pulseaudio-discuss mailing list pulseaudio-discuss@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss