From 8315fd7de60eaef1bb110ae2fb903248be056398 Mon Sep 17 00:00:00 2001 From: alex Date: Sat, 30 Apr 2022 12:50:28 -0700 Subject: [PATCH] ... --- src/log.c | 14 +++++++++++--- src/session.c | 6 +++--- src/watch.c | 4 ++-- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/log.c b/src/log.c index 7ce190a..5261d8e 100644 --- a/src/log.c +++ b/src/log.c @@ -43,6 +43,7 @@ static void log_enqueue(struct log_entry *p) { } static void log_entries_clean(void *p) { + printf("log_entries_clean\n"); free(helper.p); } @@ -61,21 +62,26 @@ static int log_entries_init() { } static void log_flush(void *p) { + printf("log_flush\n"); pthread_mutex_lock(&logging_mutex); + printf("log_flush2\n"); if(helper.start!=NULL) { fputs(LOG_MESSAGE_FLUSH,stderr); } + printf("log_flush3\n"); while(helper.start!=NULL) { log_print(helper.start); } + printf("log_flush4\n"); helper.start = NULL; helper.end = NULL; helper.next = 0; pthread_mutex_unlock(&logging_mutex); + printf("log_flush5\n"); } void log_print() { @@ -153,8 +159,10 @@ void *log_poll(void *p) { pthread_testcancel(); pthread_mutex_lock(&logging_mutex); + printf("logging mutex lock\n"); log_print(); pthread_mutex_unlock(&logging_mutex); + printf("logging mutex unlock\n"); } pthread_cleanup_pop(1); @@ -167,14 +175,14 @@ static void log_shutdown() { int ret_cancel, ret_join; void *res; - log_info("shutting down logging thread\n"); + printf("shutting down logging thread\n"); ret_cancel = pthread_cancel(logging_thread); ret_join = pthread_join(logging_thread,&res); - log_info("shutting down logging thread 2\n"); - logging_thread = pthread_self(); + printf("shutting down logging thread 2\n"); + if((ret_cancel!=0)||(ret_join!=0)||(res!=PTHREAD_CANCELED)) { log_err(LOG_MESSAGE_SHUTDOWN_FAILED); } else { diff --git a/src/session.c b/src/session.c index 9565c54..0aeabe8 100644 --- a/src/session.c +++ b/src/session.c @@ -10,7 +10,7 @@ static int session_torrent_resize(struct hash_map**,size_t); static void session_clean() { struct torrent *p; - log_info("clearing session\n"); + printf("clearing session\n"); for(size_t i=0;isize;i++) { p = session.torrents.paths->map[i]; @@ -23,7 +23,7 @@ static void session_clean() { hashmap_clear(session.torrents.paths); hashmap_free(session.torrents.paths); - log_info("session cleared\n"); + printf("session cleared\n"); } struct torrent *session_find_torrent(uint8_t *infohash, size_t size) { @@ -47,7 +47,7 @@ int session_setup() { return -1; } - log_info("session setup\n"); + printf("session setup\n"); return 1; } diff --git a/src/watch.c b/src/watch.c index 71e0027..34e37c7 100644 --- a/src/watch.c +++ b/src/watch.c @@ -101,10 +101,10 @@ static void watch_poll() { } static void watch_shutdown() { - log_info("watch thread stopping\n"); + printf("watch thread stopping\n"); if(0!=pthread_cancel(watching_thread)) { log_err(WATCH_MESSAGE_SHUTDOWN_FAILED); } close(watch_fd); - log_info("watch thread stopped\n"); + printf("watch thread stopped\n"); } -- 2.39.5