Kouhei Sutou
null+****@clear*****
Mon Jan 6 11:30:43 JST 2014
Kouhei Sutou 2014-01-06 11:30:43 +0900 (Mon, 06 Jan 2014) New Revision: b048ac70c0885e95f23ff72a718667a273cf316f https://github.com/groonga/groonga/commit/b048ac70c0885e95f23ff72a718667a273cf316f Message: Make lock wait time customizable Modified files: CMakeLists.txt config.h.cmake configure.ac lib/hash.c lib/io.c Modified: CMakeLists.txt (+4 -0) =================================================================== --- CMakeLists.txt 2013-12-31 22:20:52 +0900 (c7a923a) +++ CMakeLists.txt 2014-01-06 11:30:43 +0900 (879198d) @@ -67,6 +67,10 @@ set(GRN_STACK_SIZE 1024 CACHE STRING "DANGER!!! groonga stack size. Normarlly, you should not change this variable.") +set(GRN_LOCK_WAIT_TIME_NANOSECOND + 1000000 + CACHE STRING + "wait time in nanosecond to acquire a lock.") set(GRN_RELATIVE_PLUGINS_DIR "${LIB_DIR}/${GRN_PROJECT_NAME}/plugins") set(GRN_PLUGINS_DIR Modified: config.h.cmake (+3 -0) =================================================================== --- config.h.cmake 2013-12-31 22:20:52 +0900 (823927c) +++ config.h.cmake 2014-01-06 11:30:43 +0900 (3b85035) @@ -30,6 +30,9 @@ #define GRN_STACK_SIZE ${GRN_STACK_SIZE} +#define GRN_LOCK_WAIT_TIME_NANOSECOND \ + ${GRN_LOCK_WAIT_TIME_NANOSECOND} + #define GRN_RELATIVE_PLUGINS_DIR \ "${GRN_RELATIVE_PLUGINS_DIR}" #define GRN_PLUGINS_DIR "${GRN_PLUGINS_DIR}" Modified: configure.ac (+11 -0) =================================================================== --- configure.ac 2013-12-31 22:20:52 +0900 (216b532) +++ configure.ac 2014-01-06 11:30:43 +0900 (74746dd) @@ -441,6 +441,17 @@ AC_ARG_WITH(stack_size, GRN_STACK_SIZE="$withval") AC_DEFINE_UNQUOTED(GRN_STACK_SIZE, [$GRN_STACK_SIZE], [stack size]) +# lock wait time +GRN_LOCK_WAIT_TIME_NANOSECOND=1000000 +AC_ARG_WITH(lock_wait_time, + [AS_HELP_STRING([--with-lock-wait-time=NANOSECONDS], + [This option specifies wait time in nanosecond to acquire a lock. + (default=$GRN_LOCK_WAIT_TIME_NANOSECOND)])], + GRN_LOCK_WAIT_TIME_NANOSECOND="$withval") +AC_DEFINE_UNQUOTED(GRN_LOCK_WAIT_TIME_NANOSECOND, + [$GRN_LOCK_WAIT_TIME_NANOSECOND], + [lock wait time in nanosecond]) + if test "$os_win32" != "yes"; then AC_CHECK_HEADERS(pthread.h) AC_SEARCH_LIBS(pthread_create, pthread, Modified: lib/hash.c (+1 -1) =================================================================== --- lib/hash.c 2013-12-31 22:20:52 +0900 (d3a28c5) +++ lib/hash.c 2014-01-06 11:30:43 +0900 (7940284) @@ -2002,7 +2002,7 @@ grn_hash_lock(grn_ctx *ctx, grn_hash *hash, int timeout) GRN_LOG(ctx, GRN_LOG_NOTICE, "hash(%p) collisions(%d/%d)", hash, _ncolls, _ncalls); } } - grn_nanosleep(1000000); + grn_nanosleep(GRN_LOCK_WAIT_TIME_NANOSECOND); continue; } return GRN_SUCCESS; Modified: lib/io.c (+1 -1) =================================================================== --- lib/io.c 2013-12-31 22:20:52 +0900 (87a7853) +++ lib/io.c 2014-01-06 11:30:43 +0900 (7b68ce8) @@ -1317,7 +1317,7 @@ grn_io_lock(grn_ctx *ctx, grn_io *io, int timeout) "io(%s) collisions(%d/%d)", io->path, _ncolls, _ncalls); } } - grn_nanosleep(1000000); + grn_nanosleep(GRN_LOCK_WAIT_TIME_NANOSECOND); continue; } return GRN_SUCCESS; -------------- next part -------------- HTML����������������������������...Download