1
0
mirror of https://github.com/fumiama/simple-dict.git synced 2026-06-05 02:00:25 +08:00

fix: sigsegv

This commit is contained in:
源文雨
2022-07-02 15:38:05 +08:00
committed by GitHub
parent ae320e6f56
commit 5f2bc0db6d

View File

@@ -564,17 +564,17 @@ static void accept_timer(void *p) {
sigaddset(&mask, SIGPIPE); // 防止处理嵌套
pthread_sigmask(SIG_BLOCK, &mask, NULL);
sleep(MAXWAITSEC / 4);
while(!pthread_kill(thread, 0)) {
sleep(MAXWAITSEC / 4);
if(is_dict_opening) touch_timer(p);
time_t waitsec = time(NULL) - timer->touch;
printf("Wait sec: %u, max: %u\n", (unsigned int)waitsec, MAXWAITSEC);
if(pthread_kill(thread, 0)) break;
if(waitsec > MAXWAITSEC) {
pthread_kill(thread, SIGQUIT);
puts("Kill thread");
break;
}
sleep(MAXWAITSEC / 4);
}
}