[Groonga-commit] groonga/groonga at 0578163 [master] io: add ctx->rc check in io_lock

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Mar 15 14:28:53 JST 2017


Kouhei Sutou	2017-03-15 14:28:53 +0900 (Wed, 15 Mar 2017)

  New Revision: 0578163ab19c83664b89ed7598e17302cc987560
  https://github.com/groonga/groonga/commit/0578163ab19c83664b89ed7598e17302cc987560

  Message:
    io: add ctx->rc check in io_lock
    
    It's for detecting request cancel while locking.

  Modified files:
    lib/io.c

  Modified: lib/io.c (+6 -0)
===================================================================
--- lib/io.c    2017-03-15 10:49:00 +0900 (8942d69)
+++ lib/io.c    2017-03-15 14:28:53 +0900 (3b48398)
@@ -1362,6 +1362,7 @@ grn_io_lock(grn_ctx *ctx, grn_io *io, int timeout)
 {
   static int _ncalls = 0, _ncolls = 0;
   uint32_t count, count_log_border = 1000;
+  uint32_t rc_check_interval = 1000;
   _ncalls++;
   if (!io) { return GRN_INVALID_ARGUMENT; }
   for (count = 0;; count++) {
@@ -1388,6 +1389,11 @@ grn_io_lock(grn_ctx *ctx, grn_io *io, int timeout)
                   "io(%s) collisions(%d/%d)", io->path, _ncolls, _ncalls);
         }
       }
+      if ((count % rc_check_interval) == 0) {
+        if (ctx->rc != GRN_SUCCESS) {
+          return ctx->rc;
+        }
+      }
       grn_nanosleep(GRN_LOCK_WAIT_TIME_NANOSECOND);
       continue;
     }
-------------- next part --------------
HTML����������������������������...
Download 



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