*** empty log message ***

svn path=/trunk/boinc/; revision=1295
This commit is contained in:
Eric Heien 2003-06-04 18:51:16 +00:00
parent 88949801b1
commit 6a45c25227
2 changed files with 30 additions and 6 deletions

View File

@ -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

View File

@ -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();