mirror of
https://github.com/fumiama/simple-dict.git
synced 2026-06-11 21:50:58 +08:00
fix: sigsegv
This commit is contained in:
4
server.c
4
server.c
@@ -564,17 +564,17 @@ static void accept_timer(void *p) {
|
|||||||
sigaddset(&mask, SIGPIPE); // 防止处理嵌套
|
sigaddset(&mask, SIGPIPE); // 防止处理嵌套
|
||||||
pthread_sigmask(SIG_BLOCK, &mask, NULL);
|
pthread_sigmask(SIG_BLOCK, &mask, NULL);
|
||||||
|
|
||||||
|
sleep(MAXWAITSEC / 4);
|
||||||
while(!pthread_kill(thread, 0)) {
|
while(!pthread_kill(thread, 0)) {
|
||||||
sleep(MAXWAITSEC / 4);
|
|
||||||
if(is_dict_opening) touch_timer(p);
|
if(is_dict_opening) touch_timer(p);
|
||||||
time_t waitsec = time(NULL) - timer->touch;
|
time_t waitsec = time(NULL) - timer->touch;
|
||||||
printf("Wait sec: %u, max: %u\n", (unsigned int)waitsec, MAXWAITSEC);
|
printf("Wait sec: %u, max: %u\n", (unsigned int)waitsec, MAXWAITSEC);
|
||||||
if(pthread_kill(thread, 0)) break;
|
|
||||||
if(waitsec > MAXWAITSEC) {
|
if(waitsec > MAXWAITSEC) {
|
||||||
pthread_kill(thread, SIGQUIT);
|
pthread_kill(thread, SIGQUIT);
|
||||||
puts("Kill thread");
|
puts("Kill thread");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
sleep(MAXWAITSEC / 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user