From patchwork Thu Jun 16 20:29:52 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 2010 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 6A09623E54 for ; Thu, 16 Jun 2011 20:31:57 +0000 (UTC) Received: from mail-vw0-f50.google.com (mail-vw0-f50.google.com [209.85.212.50]) by fiordland.canonical.com (Postfix) with ESMTP id 33A7EA18621 for ; Thu, 16 Jun 2011 20:31:57 +0000 (UTC) Received: by mail-vw0-f50.google.com with SMTP id 14so1756035vws.37 for ; Thu, 16 Jun 2011 13:31:57 -0700 (PDT) Received: by 10.52.95.194 with SMTP id dm2mr353209vdb.47.1308256316954; Thu, 16 Jun 2011 13:31:56 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.52.183.130 with SMTP id em2cs211232vdc; Thu, 16 Jun 2011 13:31:56 -0700 (PDT) Received: by 10.227.183.133 with SMTP id cg5mr1358199wbb.49.1308256310531; Thu, 16 Jun 2011 13:31:50 -0700 (PDT) Received: from smtp.smtpout.orange.fr (smtp08.smtpout.orange.fr [80.12.242.130]) by mx.google.com with ESMTP id fy2si1339808wbb.104.2011.06.16.13.31.49; Thu, 16 Jun 2011 13:31:49 -0700 (PDT) Received-SPF: neutral (google.com: 80.12.242.130 is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) client-ip=80.12.242.130; Authentication-Results: mx.google.com; spf=neutral (google.com: 80.12.242.130 is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) smtp.mail=daniel.lezcano@linaro.org Received: from monster.dhcp.lxc ([92.134.76.78]) by mwinf5d16 with ME id wkXf1g0031hMfSL03kXoKK; Thu, 16 Jun 2011 22:31:48 +0200 From: Daniel Lezcano To: patches@linaro.org Subject: [PATCH 23/28] make the mainloop immune against the signals Date: Thu, 16 Jun 2011 22:29:52 +0200 Message-Id: <1308256197-29155-23-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1308256197-29155-1-git-send-email-daniel.lezcano@linaro.org> References: <1308256197-29155-1-git-send-email-daniel.lezcano@linaro.org> ... needed at least for gdb ... Signed-off-by: Daniel Lezcano --- powerdebug.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/powerdebug.c b/powerdebug.c index 7d89a7b..8e7e78e 100644 --- a/powerdebug.c +++ b/powerdebug.c @@ -288,10 +288,17 @@ int mainloop(struct powerdebug_options *options, tval.tv_sec = options->ticktime; tval.tv_usec = (options->ticktime - tval.tv_sec) * 1000000; + again: key = select(1, &readfds, NULL, NULL, &tval); if (!key) continue; + if (key < 0) { + if (errno == EINTR) + goto again; + break; + } + if (keystroke_callback(&enter_hit, &findparent_ncurses, clkname_str, &refreshwin, options)) break;