diff options
author | fadhil riyanto <me@fadev.org> | 2024-10-01 20:34:48 +0700 |
---|---|---|
committer | fadhil riyanto <me@fadev.org> | 2024-10-01 20:34:48 +0700 |
commit | e880a89c467abdaa48b50b6ba6d6c1551537263c (patch) | |
tree | d347a8101d09b7633eb4f9985a75c7916b10d6c9 /main.c | |
parent | 424748e5b360825916f4eb1a88483ccd45de17bf (diff) |
test add mutex
Signed-off-by: fadhil riyanto <me@fadev.org>
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -628,11 +628,19 @@ static void* start_clean_conn_gc(void *srv_ctx_voidptr) if (srv_ctx->th_pool->th_pool[i].need_join == 1 && srv_ctx->th_pool->th_pool[i].is_active == 0) { + usleep(50); + + + + pthread_mutex_lock(&srv_ctx->th_pool->th_pool_mutex); + pthread_join(srv_ctx->th_pool->th_pool[i].th,&ret); srv_ctx->th_pool->th_pool[i].is_active = 0; srv_ctx->th_pool->th_pool[i].need_join = 0; printf("gc clear\n"); + + pthread_mutex_unlock(&srv_ctx->th_pool->th_pool_mutex); } @@ -758,6 +766,10 @@ static void* start_long_poll_receiver(void *srv_ctx_voidptr) EPOLL_ACCEPTFD_WATCHLIST_LEN, 20); + if (n_ready_read < 0) { + perror("epoll_wait"); + } + if (n_ready_read > 0) { for (int i = 0; i < n_ready_read; i++) { |