[Groonga-commit] groonga/groonga at 785ab37 [master] groonga: log start/end thread in lock

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Jul 24 19:00:07 JST 2015


Kouhei Sutou	2015-07-24 19:00:07 +0900 (Fri, 24 Jul 2015)

  New Revision: 785ab3717ea5ad799c28617857af171d6e168fdd
  https://github.com/groonga/groonga/commit/785ab3717ea5ad799c28617857af171d6e168fdd

  Message:
    groonga: log start/end thread in lock
    
    It's small impact for performance because thread start/end isn't
    occurred many times.

  Modified files:
    src/groonga.c

  Modified: src/groonga.c (+4 -4)
===================================================================
--- src/groonga.c    2015-07-24 18:57:28 +0900 (8ecf8a2)
+++ src/groonga.c    2015-07-24 19:00:07 +0900 (988fe15)
@@ -1910,8 +1910,8 @@ h_worker(void *arg)
   grn_ctx_init(ctx, 0);
   grn_ctx_use(ctx, (grn_obj *)arg);
   grn_ctx_recv_handler_set(ctx, h_output, &hc);
-  GRN_LOG(&grn_gctx, GRN_LOG_NOTICE, "thread start (%d/%d)", nfthreads, nthreads);
   MUTEX_LOCK(q_mutex);
+  GRN_LOG(&grn_gctx, GRN_LOG_NOTICE, "thread start (%d/%d)", nfthreads, nthreads);
   do {
     grn_obj *msg;
     nfthreads++;
@@ -1932,8 +1932,8 @@ h_worker(void *arg)
   } while (nfthreads < max_nfthreads && grn_gctx.stat != GRN_CTX_QUIT);
 exit :
   nthreads--;
-  MUTEX_UNLOCK(q_mutex);
   GRN_LOG(&grn_gctx, GRN_LOG_NOTICE, "thread end (%d/%d)", nfthreads, nthreads);
+  MUTEX_UNLOCK(q_mutex);
   grn_ctx_fin(ctx);
   return GRN_THREAD_FUNC_RETURN_VALUE;
 }
@@ -1983,8 +1983,8 @@ h_server(char *path)
 static grn_thread_func_result CALLBACK
 g_worker(void *arg)
 {
-  GRN_LOG(&grn_gctx, GRN_LOG_NOTICE, "thread start (%d/%d)", nfthreads, nthreads);
   MUTEX_LOCK(q_mutex);
+  GRN_LOG(&grn_gctx, GRN_LOG_NOTICE, "thread start (%d/%d)", nfthreads, nthreads);
   do {
     grn_ctx *ctx;
     grn_edge *edge;
@@ -2039,8 +2039,8 @@ g_worker(void *arg)
   } while (nfthreads < max_nfthreads && grn_gctx.stat != GRN_CTX_QUIT);
 exit :
   nthreads--;
-  MUTEX_UNLOCK(q_mutex);
   GRN_LOG(&grn_gctx, GRN_LOG_NOTICE, "thread end (%d/%d)", nfthreads, nthreads);
+  MUTEX_UNLOCK(q_mutex);
   return GRN_THREAD_FUNC_RETURN_VALUE;
 }
 
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index