From 6a45c252278eead8018c842c727556cf2f4193ad Mon Sep 17 00:00:00 2001 From: Eric Heien Date: Wed, 4 Jun 2003 18:51:16 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=1295 --- checkin_notes | 7 +++++++ client/main.C | 29 +++++++++++++++++++++++------ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/checkin_notes b/checkin_notes index 936223b7f4..2621b8b1cf 100755 --- a/checkin_notes +++ b/checkin_notes @@ -4437,3 +4437,10 @@ David June 4 2003 add.C backend_lib.C,h create_work.C + +Eric June 4, 2003 + - Added signal handlers for keyboard suspend/resume on UNIX + + client/ + main.C + diff --git a/client/main.C b/client/main.C index cb282f7af7..e518932739 100644 --- a/client/main.C +++ b/client/main.C @@ -111,6 +111,18 @@ void quit_client(int a) { gstate.requested_exit = true; } +void susp_client(int a) { + gstate.active_tasks.suspend_all(); + msg_printf(NULL, MSG_INFO, "Suspending activity - user request"); + signal(SIGTSTP, SIG_DFL); + raise(SIGTSTP); +} + +void resume_client(int a) { + gstate.active_tasks.unsuspend_all(); + msg_printf(NULL, MSG_INFO, "Resuming activity"); +} + int main(int argc, char** argv) { int retval; double dt; @@ -120,18 +132,23 @@ int main(int argc, char** argv) { fprintf(stderr, "Another copy of BOINC is already running\n"); exit(1); } -#ifndef _WIN32 - // Handle quit signals gracefully - signal(SIGHUP, quit_client); - signal(SIGINT, quit_client); - signal(SIGQUIT, quit_client); -#endif read_log_flags(); gstate.parse_cmdline(argc, argv); gstate.parse_env_vars(); retval = gstate.init(); if (retval) exit(retval); + +#ifndef _WIN32 + // Handle quit signals gracefully + signal(SIGHUP, quit_client); + signal(SIGINT, quit_client); + signal(SIGQUIT, quit_client); + signal(SIGPWR, quit_client); + signal(SIGTSTP, susp_client); + signal(SIGCONT, resume_client); +#endif + while (1) { if (!gstate.do_something()) { dt = dtime();