Message ID | 20181005144729.21388-9-o-takashi@sakamocchi.jp (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <alsa-devel-bounces@alsa-project.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5D082174A for <patchwork-alsa-devel@patchwork.kernel.org>; Fri, 5 Oct 2018 14:56:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4CED529247 for <patchwork-alsa-devel@patchwork.kernel.org>; Fri, 5 Oct 2018 14:56:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4142529518; Fri, 5 Oct 2018 14:56:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B5AF29247 for <patchwork-alsa-devel@patchwork.kernel.org>; Fri, 5 Oct 2018 14:56:41 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 04AE026793C; Fri, 5 Oct 2018 16:48:03 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 1D9FF267959; Fri, 5 Oct 2018 16:47:56 +0200 (CEST) Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by alsa0.perex.cz (Postfix) with ESMTP id 0A2B4267956 for <alsa-devel@alsa-project.org>; Fri, 5 Oct 2018 16:47:53 +0200 (CEST) Received: by mail-pf1-f196.google.com with SMTP id r64-v6so5164987pfb.13 for <alsa-devel@alsa-project.org>; Fri, 05 Oct 2018 07:47:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pKsrBR6wOmvp/kfzlFKnsyIHW2AKYMUdWW0aU++7P+U=; b=HvpL8NKclinPdRGyZQ5/3LKTe6U/nvW6AHUpeBd0UOI90JiJzneV+P9RBRu8uIFHkj qIwsnWjU5IcqxSDSRQ0bFI2QKeJaj5mZhiKSny0lWZYGvdtbSe7RpPb67wcMNuFfzcM6 K2BJcySHqEreTLKuM1+iXkvL1xUwgOYHQgGr//neeXtvO8+ZcAVIaQYJ2PhsaIs17Dsk nXz0dibjoiRhfqm3ATOCGIkZbMu4RTl+0qV2/tI+8Qlf2USAKg88jrb02fp/IJZEx4ba +6lTheaNtLDm5ifTQY0eKU17tCPZ7MxXwMajJ829o4tM48bjyRClFXt/GetZ8gBTXBkJ p1tA== X-Gm-Message-State: ABuFfohTdqKcE2xxbq0u/rmAq3dHqGB4lwI9qWeI7qITUs4Bdi5Y81h7 MJuXLgdENSnsMoarfCtk2E5zyFrN X-Google-Smtp-Source: ACcGV61q8WRn4qo7srgXBphtEJu7l6IZH8EItIGs8sVayYAUVq060a4eNBc75+KTvYP5RL3ZCuqsxw== X-Received: by 2002:a62:5251:: with SMTP id g78-v6mr12288188pfb.256.1538750872927; Fri, 05 Oct 2018 07:47:52 -0700 (PDT) Received: from localhost.localdomain ([2405:6580:9660:3200:6c76:a5ca:435f:7df]) by smtp.gmail.com with ESMTPSA id y8-v6sm18836207pfd.168.2018.10.05.07.47.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Oct 2018 07:47:52 -0700 (PDT) From: Takashi Sakamoto <o-takashi@sakamocchi.jp> To: tiwai@suse.de, thomas@coldfix.de Date: Fri, 5 Oct 2018 23:47:28 +0900 Message-Id: <20181005144729.21388-9-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181005144729.21388-1-o-takashi@sakamocchi.jp> References: <20181005144729.21388-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH][RFC][alsa-utils 8/9] alsactl: handle disconnection of sound card X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" <alsa-devel.alsa-project.org> List-Unsubscribe: <http://mailman.alsa-project.org/mailman/options/alsa-devel>, <mailto:alsa-devel-request@alsa-project.org?subject=unsubscribe> List-Archive: <http://mailman.alsa-project.org/pipermail/alsa-devel/> List-Post: <mailto:alsa-devel@alsa-project.org> List-Help: <mailto:alsa-devel-request@alsa-project.org?subject=help> List-Subscribe: <http://mailman.alsa-project.org/mailman/listinfo/alsa-devel>, <mailto:alsa-devel-request@alsa-project.org?subject=subscribe> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP |
Series |
alsactl: monitor mode friendly for
|
expand
|
diff --git a/alsactl/monitor.c b/alsactl/monitor.c index 807963c..4eb1ad1 100644 --- a/alsactl/monitor.c +++ b/alsactl/monitor.c @@ -312,6 +312,10 @@ static int run_dispatcher(int epfd, struct src_entry *srcs) struct src_entry *src = (struct src_entry *)ev->data.ptr; if (ev->events & EPOLLIN) print_event(src->handle, src->name); + if (ev->events & EPOLLERR) { + operate_dispatcher(epfd, EPOLL_CTL_DEL, NULL, src); + remove_source_entry(src); + } } }
Once sound card becomes disconnection state, corresponding control node becomes to emit error event for listeners. When catching this type of event, event dispatcher should stop observation of the node. However, at present, a mode of monitor can't handle this correctly. As a result, poll(2) is executed quite frequently in loop with no wait. This results 100% consumption of CPU time. This commit takes the dispatcher to remove the node from observation list when detecting the disconnection state. Reported-by: Thomas Gläßle <thomas@coldfix.de> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> --- alsactl/monitor.c | 4 ++++ 1 file changed, 4 insertions(+)