[Groonga-commit] groonga/groonga at 2cf68de [master] Add missing lock

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Oct 16 16:28:56 JST 2015


Kouhei Sutou	2015-10-16 16:28:56 +0900 (Fri, 16 Oct 2015)

  New Revision: 2cf68dedd59930fe93cbda60a6b9a7fa7c05e93a
  https://github.com/groonga/groonga/commit/2cf68dedd59930fe93cbda60a6b9a7fa7c05e93a

  Message:
    Add missing lock

  Modified files:
    lib/conf.c

  Modified: lib/conf.c (+12 -1)
===================================================================
--- lib/conf.c    2015-10-16 12:48:13 +0900 (5408e8b)
+++ lib/conf.c    2015-10-16 16:28:56 +0900 (d9fbc5e)
@@ -60,7 +60,18 @@ grn_conf_set(grn_ctx *ctx,
   }
 
   conf = ((grn_db *)db)->conf;
-  id = grn_hash_add(ctx, conf, key, key_size, &packed_value, NULL);
+  {
+    grn_rc rc;
+    rc = grn_io_lock(ctx, conf->io, grn_lock_timeout);
+    if (rc != GRN_SUCCESS) {
+      if (ctx->rc == GRN_SUCCESS) {
+        ERR(rc, "[conf][set] failed to lock");
+      }
+      GRN_API_RETURN(rc);
+    }
+    id = grn_hash_add(ctx, conf, key, key_size, &packed_value, NULL);
+    grn_io_unlock(conf->io);
+  }
   if (id == GRN_ID_NIL && ctx->rc == GRN_SUCCESS) {
     ERR(GRN_INVALID_ARGUMENT,
         "[conf][set] failed to set: name=<%.*s>: <%d>",
-------------- next part --------------
HTML����������������������������...
Download 



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