From a7faec206e54cc6c635ca9789ac0940630f07c31 Mon Sep 17 00:00:00 2001 From: Yann Dirson Date: Sun, 13 Oct 2013 23:25:42 +0200 Subject: [PATCH] Restore SIGINT for stopping gnushogi when thinking. SIGINT is unfortunately part of the protocol inherited from gnuchess4, and is used by xboard as such. So this was not a proper fix for the original issue. This reverts commit 00e10bc4a760150665436b17c50abf264f28d435, "Don't intercept INT and QUIT signals, and use USR1 instead of QUIT for". --- gnushogi/commondsp.c | 2 +- gnushogi/init.c | 2 +- gnushogi/rawdsp.c | 6 ++++-- xshogi/xshogi.c | 6 +++--- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/gnushogi/commondsp.c b/gnushogi/commondsp.c index db90fd3..31dc80e 100644 --- a/gnushogi/commondsp.c +++ b/gnushogi/commondsp.c @@ -2162,7 +2162,7 @@ InputCommand(char *command) #endif } - signal(SIGUSR1, TerminateSearch); + signal(SIGINT, TerminateSearch); } diff --git a/gnushogi/init.c b/gnushogi/init.c index b971b7a..74e1744 100644 --- a/gnushogi/init.c +++ b/gnushogi/init.c @@ -1277,7 +1277,7 @@ InitMain(void) if (XSHOGI) { - signal(SIGUSR1, TerminateSearch); + signal(SIGINT, TerminateSearch); TCmoves = 40; TCminutes = 5; diff --git a/gnushogi/rawdsp.c b/gnushogi/rawdsp.c index 7d17287..2109ca9 100644 --- a/gnushogi/rawdsp.c +++ b/gnushogi/rawdsp.c @@ -314,7 +314,8 @@ Raw_help(void) TimeControl.moves[black], TimeControl.clock[black] / 100, TCadd/100, MaxSearchDepth); - signal(SIGUSR1, Raw_TerminateSearch); + signal(SIGINT, Raw_TerminateSearch); + signal(SIGQUIT, Raw_TerminateSearch); } @@ -486,7 +487,8 @@ SetupBoard(void) void Raw_SearchStartStuff(short side) { - signal(SIGUSR1, Raw_TerminateSearch); + signal(SIGINT, Raw_TerminateSearch); + signal(SIGQUIT, Raw_TerminateSearch); if (flag.post) { diff --git a/xshogi/xshogi.c b/xshogi/xshogi.c index f6317dd..1d998d6 100644 --- a/xshogi/xshogi.c +++ b/xshogi/xshogi.c @@ -7131,7 +7131,7 @@ void DisplayTitle(char *title) /* CHECKME: does this work? - * This routine sends a SIGUSR1 to gnushogi to awaken it + * This routine sends a SIGINT (^C interrupt) to gnushogi to awaken it * if it might be busy thinking on our time. This normally isn't needed, * but is useful on systems where the FIONREAD ioctl doesn't work since * on those systems the gnushogi feature that lets you interrupt its thinking @@ -7159,11 +7159,11 @@ Attention(int pid) { if (xshogiDebug || localPlayer.appData.debugMode) { - fprintf(stderr, "Sending SIGUSR1 to %s\n", + fprintf(stderr, "Sending SIGINT to %s\n", ((pid == firstProgramPID) ? "first" : "second")); } - (void)kill(pid, SIGUSR1); /* stop it thinking */ + (void)kill(pid, SIGINT); /* stop it thinking */ } break; -- 1.7.0.4