diff options
author | scw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2007-05-30 19:57:26 +0800 |
---|---|---|
committer | scw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2007-05-30 19:57:26 +0800 |
commit | 05df0b0f9445089d03f7a2933875b9c7266eb96e (patch) | |
tree | b39e0bcd81ed5af868588d32019aa09c76a9dc3e /mbbsd | |
parent | 93fdbc80ffe40eba7c445d3660e97f458632e4ba (diff) | |
download | pttbbs-05df0b0f9445089d03f7a2933875b9c7266eb96e.tar pttbbs-05df0b0f9445089d03f7a2933875b9c7266eb96e.tar.gz pttbbs-05df0b0f9445089d03f7a2933875b9c7266eb96e.tar.bz2 pttbbs-05df0b0f9445089d03f7a2933875b9c7266eb96e.tar.lz pttbbs-05df0b0f9445089d03f7a2933875b9c7266eb96e.tar.xz pttbbs-05df0b0f9445089d03f7a2933875b9c7266eb96e.tar.zst pttbbs-05df0b0f9445089d03f7a2933875b9c7266eb96e.zip |
sigmask properly when leaving chess
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3522 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r-- | mbbsd/chess.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/mbbsd/chess.c b/mbbsd/chess.c index 28da6f3b..9df4f5bc 100644 --- a/mbbsd/chess.c +++ b/mbbsd/chess.c @@ -1015,6 +1015,7 @@ ChessPlay(ChessInfo* info) ChessGameResult game_result; void (*old_handler)(int); const char* game_result_str = 0; + sigset_t old_sigset; if (info == NULL) return; @@ -1046,7 +1047,7 @@ ChessPlay(ChessInfo* info) sigemptyset(&sigset); sigaddset(&sigset, SIGUSR1); - sigprocmask(SIG_UNBLOCK, &sigset, NULL); + sigprocmask(SIG_UNBLOCK, &sigset, &old_sigset); } if (info->mode == CHESS_MODE_WATCH) { @@ -1125,17 +1126,10 @@ ChessPlay(ChessInfo* info) if (info->mode != CHESS_MODE_REPLAY) ChessGenLog(info, game_result); + // currutmp->sig = -1; + sigprocmask(SIG_SETMASK, &old_sigset, NULL); + Signal(SIGUSR1, old_handler); - { - sigset_t sigset; - - sigemptyset(&sigset); - sigaddset(&sigset, SIGUSR1); - sigprocmask(SIG_BLOCK, &sigset, NULL); - - // currutmp->sig = -1; - Signal(SIGUSR1, old_handler); - } CurrentPlayingGameInfo = NULL; } |