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

修复kill thread入参错误

This commit is contained in:
fumiama
2021-05-04 16:19:40 +08:00
parent b32882691e
commit a685b2e707

View File

@@ -318,18 +318,16 @@ void handle_quit(int signo) {
void accept_timer(void *p) {
pthread_detach(pthread_self());
THREADTIMER *timer = timer_pointer_of(p);
while(!pthread_kill(*(timer->thread), 0)) {
sleep(MAXWAITSEC);
while(*(timer->thread) && !pthread_kill(*(timer->thread), 0)) {
sleep(MAXWAITSEC / 4);
puts("Check accept status");
if(time(NULL) - timer->touch > MAXWAITSEC) {
puts("Call kill thread");
kill_thread(timer);
puts("Free timer");
free(p);
puts("Finish checking accept status");
break;
}
if(time(NULL) - timer->touch > MAXWAITSEC) break;
}
puts("Call kill thread");
kill_thread(timer);
puts("Free timer");
free(timer);
puts("Finish calling kill thread");
}
void kill_thread(THREADTIMER* timer) {