aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@linaro.org>2011-06-08 23:30:01 +0200
committerDaniel Lezcano <daniel.lezcano@free.fr>2011-06-08 23:30:01 +0200
commite8cf9b82f0bf0267d24cd3d853bfc378e9c43009 (patch)
tree1bd68b13df7c10b2fb103a99c1c5f7d872a5fd3d
parent6d42e81bf9dc4b2152f678cc205a5e7175be15bc (diff)
downloadpowerdebug-e8cf9b82f0bf0267d24cd3d853bfc378e9c43009.tar.gz
make the mainloop immune against the signals
... needed at least for gdb ... Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
-rw-r--r--powerdebug.c7
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;