From 9a7563ba3a32dfde106ff27b356f0dfe87cd78f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Sat, 15 Oct 2022 11:26:58 +0800 Subject: [PATCH] add more logs --- server.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server.c b/server.c index 559b358..248fbd3 100644 --- a/server.c +++ b/server.c @@ -657,12 +657,15 @@ static void handle_pipe(int signo) { } static void handle_accept(void *p) { + #ifdef DEBUG + printf("accept ptr: %p\n", p); + #endif pthread_cleanup_push((void*)&cleanup_thread, p); puts("Handling accept..."); while(1) { pthread_t thread = timer_pointer_of(p)->timerthread; if(!thread || pthread_kill(thread, 0)) { - printf("Creating timer thread..."); + puts("Creating timer thread..."); pthread_cond_init(&timer_pointer_of(p)->tc, NULL); pthread_mutex_init(&timer_pointer_of(p)->tmc, NULL); if (pthread_create(&thread, &attr, (void *)&accept_timer, p)) { @@ -674,7 +677,7 @@ static void handle_accept(void *p) { timer_pointer_of(p)->timerthread = thread; puts("Creating timer thread succeeded"); } else { - printf("Waking up timer thread..."); + puts("Waking up timer thread..."); pthread_mutex_lock(&timer_pointer_of(p)->tmc); pthread_cond_signal(&timer_pointer_of(p)->tc); // wakeup thread pthread_mutex_unlock(&timer_pointer_of(p)->tmc);