summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorfadhil riyanto <me@fadev.org>2024-10-01 20:34:48 +0700
committerfadhil riyanto <me@fadev.org>2024-10-01 20:34:48 +0700
commite880a89c467abdaa48b50b6ba6d6c1551537263c (patch)
treed347a8101d09b7633eb4f9985a75c7916b10d6c9 /main.c
parent424748e5b360825916f4eb1a88483ccd45de17bf (diff)
test add mutex
Signed-off-by: fadhil riyanto <me@fadev.org>
Diffstat (limited to 'main.c')
-rw-r--r--main.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/main.c b/main.c
index 03cd88a..3420846 100644
--- a/main.c
+++ b/main.c
@@ -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++) {