[Groonga-commit] groonga/groonga at 8029ddb [master] thread_limit: use "limit" instead of "count"

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Aug 18 20:13:02 JST 2015


Kouhei Sutou	2015-08-18 20:13:02 +0900 (Tue, 18 Aug 2015)

  New Revision: 8029ddb6aee2e2dc94e3e49ec2cb07c4d1bd5a61
  https://github.com/groonga/groonga/commit/8029ddb6aee2e2dc94e3e49ec2cb07c4d1bd5a61

  Message:
    thread_limit: use "limit" instead of "count"
    
    Because "limit" is used in "cache_limit". "thread_limit" is similar to
    "cache_limit". So we should use "limit" instead of "count".

  Modified files:
    doc/files.am
    doc/locale/ja/LC_MESSAGES/reference.po
    doc/source/reference/api/grn_thread.rst
    doc/source/reference/commands/database_unmap.rst
    doc/source/reference/commands/logical_parameters.rst
    include/groonga/thread.h
    lib/proc.c
    lib/thread.c
    src/groonga.c
    src/httpd/nginx-module/ngx_http_groonga_module.c
  Renamed files:
    doc/source/example/reference/commands/thread_limit/max.log
      (from doc/source/example/reference/commands/thread_count/new_count.log)
    doc/source/example/reference/commands/thread_limit/usage_get.log
      (from doc/source/example/reference/commands/thread_count/usage_get.log)
    doc/source/example/reference/commands/thread_limit/usage_set.log
      (from doc/source/example/reference/commands/thread_count/usage_set.log)
    doc/source/reference/commands/thread_limit.rst
      (from doc/source/reference/commands/thread_count.rst)

  Modified: doc/files.am (+10 -10)
===================================================================
--- doc/files.am    2015-08-18 19:59:14 +0900 (6dcfcb4)
+++ doc/files.am    2015-08-18 20:13:02 +0900 (d0c7e04)
@@ -174,9 +174,9 @@ absolute_source_files = \
 	$(top_srcdir)/doc/source/example/reference/commands/table_list.log \
 	$(top_srcdir)/doc/source/example/reference/commands/table_rename/usage.log \
 	$(top_srcdir)/doc/source/example/reference/commands/table_tokenize/simple_example.log \
-	$(top_srcdir)/doc/source/example/reference/commands/thread_count/new_count.log \
-	$(top_srcdir)/doc/source/example/reference/commands/thread_count/usage_get.log \
-	$(top_srcdir)/doc/source/example/reference/commands/thread_count/usage_set.log \
+	$(top_srcdir)/doc/source/example/reference/commands/thread_limit/max.log \
+	$(top_srcdir)/doc/source/example/reference/commands/thread_limit/usage_get.log \
+	$(top_srcdir)/doc/source/example/reference/commands/thread_limit/usage_set.log \
 	$(top_srcdir)/doc/source/example/reference/commands/tokenize/add_mode.log \
 	$(top_srcdir)/doc/source/example/reference/commands/tokenize/flags_enable_tokenized_delimiter.log \
 	$(top_srcdir)/doc/source/example/reference/commands/tokenize/get_mode.log \
@@ -614,7 +614,7 @@ absolute_source_files = \
 	$(top_srcdir)/doc/source/reference/commands/table_remove.rst \
 	$(top_srcdir)/doc/source/reference/commands/table_rename.rst \
 	$(top_srcdir)/doc/source/reference/commands/table_tokenize.rst \
-	$(top_srcdir)/doc/source/reference/commands/thread_count.rst \
+	$(top_srcdir)/doc/source/reference/commands/thread_limit.rst \
 	$(top_srcdir)/doc/source/reference/commands/tokenize.rst \
 	$(top_srcdir)/doc/source/reference/commands/tokenizer_list.rst \
 	$(top_srcdir)/doc/source/reference/commands/truncate.rst \
@@ -891,9 +891,9 @@ source_files_relative_from_doc_dir = \
 	source/example/reference/commands/table_list.log \
 	source/example/reference/commands/table_rename/usage.log \
 	source/example/reference/commands/table_tokenize/simple_example.log \
-	source/example/reference/commands/thread_count/new_count.log \
-	source/example/reference/commands/thread_count/usage_get.log \
-	source/example/reference/commands/thread_count/usage_set.log \
+	source/example/reference/commands/thread_limit/max.log \
+	source/example/reference/commands/thread_limit/usage_get.log \
+	source/example/reference/commands/thread_limit/usage_set.log \
 	source/example/reference/commands/tokenize/add_mode.log \
 	source/example/reference/commands/tokenize/flags_enable_tokenized_delimiter.log \
 	source/example/reference/commands/tokenize/get_mode.log \
@@ -1331,7 +1331,7 @@ source_files_relative_from_doc_dir = \
 	source/reference/commands/table_remove.rst \
 	source/reference/commands/table_rename.rst \
 	source/reference/commands/table_tokenize.rst \
-	source/reference/commands/thread_count.rst \
+	source/reference/commands/thread_limit.rst \
 	source/reference/commands/tokenize.rst \
 	source/reference/commands/tokenizer_list.rst \
 	source/reference/commands/truncate.rst \
@@ -1666,7 +1666,7 @@ html_files_relative_from_locale_dir = \
 	html/_sources/reference/commands/table_remove.txt \
 	html/_sources/reference/commands/table_rename.txt \
 	html/_sources/reference/commands/table_tokenize.txt \
-	html/_sources/reference/commands/thread_count.txt \
+	html/_sources/reference/commands/thread_limit.txt \
 	html/_sources/reference/commands/tokenize.txt \
 	html/_sources/reference/commands/tokenizer_list.txt \
 	html/_sources/reference/commands/truncate.txt \
@@ -1895,7 +1895,7 @@ html_files_relative_from_locale_dir = \
 	html/reference/commands/table_remove.html \
 	html/reference/commands/table_rename.html \
 	html/reference/commands/table_tokenize.html \
-	html/reference/commands/thread_count.html \
+	html/reference/commands/thread_limit.html \
 	html/reference/commands/tokenize.html \
 	html/reference/commands/tokenizer_list.html \
 	html/reference/commands/truncate.html \

  Modified: doc/locale/ja/LC_MESSAGES/reference.po (+42 -42)
===================================================================
--- doc/locale/ja/LC_MESSAGES/reference.po    2015-08-18 19:59:14 +0900 (dc73923)
+++ doc/locale/ja/LC_MESSAGES/reference.po    2015-08-18 20:13:02 +0900 (443e586)
@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: 1.2.1\n"
 "Report-Msgid-Bugs-To: \n"
-"PO-Revision-Date: 2015-08-17 19:22+0900\n"
+"PO-Revision-Date: 2015-08-18 20:12+0900\n"
 "Last-Translator: Masafumi Yokoyama <yokoyama �� clear-code.com>\n"
 "Language-Team: Japanese\n"
 "Language: ja\n"
@@ -2108,11 +2108,11 @@ msgstr "最大スレッド数を返します。"
 
 # ae854b13510149c18f28da3daab30415
 msgid ""
-"If :c:type:`grn_thread_get_count_func` isn't set by :c:func:"
-"`grn_thread_set_get_count_func()`, it always returns ``0``."
+"If :c:type:`grn_thread_get_limit_func` isn't set by :c:func:"
+"`grn_thread_set_get_limit_func()`, it always returns ``0``."
 msgstr ""
-":c:func:`grn_thread_set_get_count_func()` で :c:type:"
-"`grn_thread_get_count_func` を設定していない場合は、常に ``0`` を返します。"
+":c:func:`grn_thread_set_get_limit_func()` で :c:type:"
+"`grn_thread_get_limit_func` を設定していない場合は、常に ``0`` を返します。"
 
 msgid "The max number of threads or ``0``."
 msgstr "最大スレッド数または ``0`` 。"
@@ -2122,11 +2122,11 @@ msgstr "最大スレッド数を設定します。"
 
 # d70504eb8c29440f92fad6f12e5c95d1
 msgid ""
-"If :c:type:`grn_thread_set_count_func` isn't set by :c:func:"
-"`grn_thread_set_set_count_func()`, it does nothing."
+"If :c:type:`grn_thread_set_limit_func` isn't set by :c:func:"
+"`grn_thread_set_set_limit_func()`, it does nothing."
 msgstr ""
-":c:func:`grn_thread_set_set_count_func()` で :c:type:"
-"`grn_thread_set_count_func` を設定していない場合はなにもしません。"
+":c:func:`grn_thread_set_set_limit_func()` で :c:type:"
+"`grn_thread_set_limit_func` を設定していない場合はなにもしません。"
 
 msgid "The new max number of threads."
 msgstr "新しい最大スレッド数。"
@@ -2138,9 +2138,9 @@ msgstr "最大スレッド数を返すカスタム関数を設定します。"
 # 28662d6ecdd146208aab442bb5008656
 msgid ""
 "``data`` is passed to ``func`` when ``func`` is called from :c:func:"
-"`grn_thread_get_count()`."
+"`grn_thread_get_limit()`."
 msgstr ""
-"``data`` は :c:func:`grn_thread_get_count()` が ``func`` を呼ぶときに "
+"``data`` は :c:func:`grn_thread_get_limit()` が ``func`` を呼ぶときに "
 "``func`` に渡されます。"
 
 # 2ef1d134699b415298538ec3b54b7618
@@ -2159,9 +2159,9 @@ msgstr "最大スレッド数を設定するカスタム関数を設定します
 # e43438da901146a7b8e6d9510e17502c
 msgid ""
 "``data`` is passed to ``func`` when ``func`` is called from :c:func:"
-"`grn_thread_set_count()`."
+"`grn_thread_set_limit()`."
 msgstr ""
-"``data`` は :c:func:`grn_thread_set_count()` が ``func`` を呼ぶときに "
+"``data`` は :c:func:`grn_thread_set_limit()` が ``func`` を呼ぶときに "
 "``func`` に渡されます。"
 
 msgid "The custom function that sets the max number of threads."
@@ -4302,10 +4302,10 @@ msgstr ""
 
 # 1a1d821590c143aba13d738c2616a1e8
 msgid ""
-"You can use this command only when :doc:`thread_count` returns ``1``. It "
+"You can use this command only when :doc:`thread_limit` returns ``1``. It "
 "means that this command doesn't work with multithreading."
 msgstr ""
-"このコマンドは :doc:`thread_count` が ``1`` を返すときしか使えません。つま"
+"このコマンドは :doc:`thread_limit` が ``1`` を返すときしか使えません。つま"
 "り、マルチスレッド環境ではこのコマンドは動かないということです。"
 
 msgid "This command takes no parameters::"
@@ -5445,12 +5445,12 @@ msgid ""
 "The parameters are independent in each thread. (To be exact, each :c:type:"
 "`grn_ctx`.) If you want to control the parameters perfectly, you should "
 "reduce the max number of threads to ``1`` by :doc:`/reference/commands/"
-"thread_count` while you're using the parameters."
+"thread_limit` while you're using the parameters."
 msgstr ""
 "これらのパラメーターの値は各スレッドごとで独立しています。(正確に言うと、 :"
 "c:type:`grn_ctx` 毎に独立しています。)これらのパラメーターを完全に制御したい"
 "場合は、これらのパラメーターを使っている間は :doc:`/reference/commands/"
-"thread_count` を使って最大スレッド数を ``1`` にしてください。"
+"thread_limit` を使って最大スレッド数を ``1`` にしてください。"
 
 msgid "You need to register ``sharding`` plugin to use this command:"
 msgstr "このコマンドを使うには事前に ``sharding`` プラグインを登録します。"
@@ -10126,18 +10126,18 @@ msgid ":doc:`/reference/commands/tokenize`"
 msgstr ""
 
 # 4e8b0f6aec594ec2b72eaf738d2e7dbc
-msgid "``thread_count``"
+msgid "``thread_limit``"
 msgstr ""
 
-msgid "``thread_count`` has the following two features:"
-msgstr "``thread_count`` は次の2つの機能を提供します。"
+msgid "``thread_limit`` has the following two features:"
+msgstr "``thread_limit`` は次の2つの機能を提供します。"
 
 # 764c7094f55347f1baf508249903cddb
 msgid ""
 ":doc:`/reference/executables/groonga` is the only Groonga server that "
-"supports full ``thread_count`` features."
+"supports full ``thread_limit`` features."
 msgstr ""
-":doc:`/reference/executables/groonga` は ``thread_count`` のすべての機能を提"
+":doc:`/reference/executables/groonga` は ``thread_limit`` のすべての機能を提"
 "供する唯一のGroongaサーバーです。"
 
 # ee3a08a9f8cd4ffda0d2d70fbe286883
@@ -10154,19 +10154,19 @@ msgstr ""
 
 # d2dd04f9a8634435b8efffbb57b98ea5
 msgid ""
-"If you're using Groonga as a library, ``thread_count`` doesn't work without "
-"you set custom functions by :c:func:`grn_thread_set_get_count_func()` and :c:"
-"func:`grn_thread_set_set_count_func()`. If you set a function by :c:func:"
-"`grn_thread_set_get_count_func()`, the feature that returns the max number "
+"If you're using Groonga as a library, ``thread_limit`` doesn't work without "
+"you set custom functions by :c:func:`grn_thread_set_get_limit_func()` and :c:"
+"func:`grn_thread_set_set_limit_func()`. If you set a function by :c:func:"
+"`grn_thread_set_get_limit_func()`, the feature that returns the max number "
 "of threads works. If you set a function by :c:func:"
-"`grn_thread_set_set_count_func()`, the feature that sets the max number of "
+"`grn_thread_set_set_limit_func()`, the feature that sets the max number of "
 "threads works."
 msgstr ""
 "Groongaをライブラリーとして使っている場合、 :c:func:"
-"`grn_thread_set_get_count_func()` と :c:func:"
-"`grn_thread_set_set_count_func()` でカスタム関数を設定しない限り動きませ"
-"ん。 :c:func:`grn_thread_set_get_count_func()` でカスタム関数を設定すると最大"
-"スレッド数を返す機能が動きます。 :c:func:`grn_thread_set_set_count_func()` で"
+"`grn_thread_set_get_limit_func()` と :c:func:"
+"`grn_thread_set_set_limit_func()` でカスタム関数を設定しない限り動きませ"
+"ん。 :c:func:`grn_thread_set_get_limit_func()` でカスタム関数を設定すると最大"
+"スレッド数を返す機能が動きます。 :c:func:`grn_thread_set_set_limit_func()` で"
 "カスタム関数を設定すると最大スレッド数を設定する機能が動きます。"
 
 msgid ""
@@ -10180,17 +10180,17 @@ msgstr ""
 "ことです。"
 
 msgid ""
-"You can set the max number of threads by calling ``new_count`` parameter:"
-msgstr "``new_count`` 引数つきで呼び出すと最大スレッド数を設定できます。"
+"You can set the max number of threads by calling ``max`` parameter:"
+msgstr "``max`` 引数つきで呼び出すと最大スレッド数を設定できます。"
 
 # c9ebfcbe84104711bd3a7ff497f253eb
 msgid ""
-"It returns the previous max number of threads when you pass ``new_count`` "
+"It returns the previous max number of threads when you pass ``max`` "
 "parameter."
-msgstr "``new_count`` 引数を渡したときは設定前の最大スレッド数が返ります。"
+msgstr "``max`` 引数を渡したときは設定前の最大スレッド数が返ります。"
 
 # 4a4375d392864b309ad02aa21d744ad7
-msgid "``new_count``"
+msgid "``max``"
 msgstr ""
 
 msgid "Specifies the new max number of threads."
@@ -10202,10 +10202,10 @@ msgstr "正の整数を指定してください。"
 
 # c4d28ae72ea943b18a2797132f2f6f1d
 msgid ""
-"If you specify ``new_count`` parameter, ``thread_count`` returns the max "
-"number of threads before ``new_count`` is applied."
+"If you specify ``max`` parameter, ``thread_limit`` returns the max "
+"number of threads before ``max`` is applied."
 msgstr ""
-"``new_count`` 引数を指定した場合、 ``thread_count`` は ``new_count`` を適用す"
+"``max`` 引数を指定した場合、 ``thread_limit`` は ``max`` を適用す"
 "る前の最大スレッド数を返します。"
 
 msgid "The command returns the max number of threads as body::"
@@ -10213,10 +10213,10 @@ msgstr "このコマンドのボディは最大スレッド数になります::"
 
 # 2e855028334b42bf967eca5a26a37df8
 msgid ""
-"If ``new_count`` is specified, ``N_MAX_THREADS`` is the max number of "
-"threads before ``new_count`` is applied."
+"If ``max`` is specified, ``N_MAX_THREADS`` is the max number of "
+"threads before ``max`` is applied."
 msgstr ""
-"``new_count`` を指定したときは ``N_MAX_THREADS`` は ``new_count`` を適用する"
+"``max`` を指定したときは ``N_MAX_THREADS`` は ``max`` を適用する"
 "前の最大スレッド数になります。"
 
 msgid "``tokenize``"

  Renamed: doc/source/example/reference/commands/thread_limit/max.log (+1 -1) 71%
===================================================================
--- doc/source/example/reference/commands/thread_count/new_count.log    2015-08-18 19:59:14 +0900 (63a37e3)
+++ doc/source/example/reference/commands/thread_limit/max.log    2015-08-18 20:13:02 +0900 (b041f99)
@@ -1,4 +1,4 @@
 Execution example::
 
-  thread_count --new_count 3
+  thread_limit --max 3
   # [[0, 1337566253.89858, 0.000355720520019531], 4]

  Renamed: doc/source/example/reference/commands/thread_limit/usage_get.log (+1 -1) 83%
===================================================================
--- doc/source/example/reference/commands/thread_count/usage_get.log    2015-08-18 19:59:14 +0900 (31a8ed5)
+++ doc/source/example/reference/commands/thread_limit/usage_get.log    2015-08-18 20:13:02 +0900 (6ffd41c)
@@ -1,4 +1,4 @@
 Execution example::
 
-  thread_count
+  thread_limit
   # [[0, 1337566253.89858, 0.000355720520019531], 2]

  Renamed: doc/source/example/reference/commands/thread_limit/usage_set.log (+1 -1) 71%
===================================================================
--- doc/source/example/reference/commands/thread_count/usage_set.log    2015-08-18 19:59:14 +0900 (30b645e)
+++ doc/source/example/reference/commands/thread_limit/usage_set.log    2015-08-18 20:13:02 +0900 (9ed7627)
@@ -1,4 +1,4 @@
 Execution example::
 
-  thread_count --new_count 4
+  thread_limit --max 4
   # [[0, 1337566253.89858, 0.000355720520019531], 2]

  Modified: doc/source/reference/api/grn_thread.rst (+19 -19)
===================================================================
--- doc/source/reference/api/grn_thread.rst    2015-08-18 19:59:14 +0900 (a6c2d65)
+++ doc/source/reference/api/grn_thread.rst    2015-08-18 20:13:02 +0900 (b695424)
@@ -32,23 +32,23 @@ decreased.
    static uint32_t max_nfthreads;
 
    static uint32_t
-   groonga_get_thread_count(void *data)
+   groonga_get_thread_limit(void *data)
    {
      return max_nfthreads;
    }
 
    static void
-   groonga_set_thread_count(uint32_t new_count, void *data)
+   groonga_set_thread_limit(uint32_t new_limit, void *data)
    {
      uint32_t i;
      uint32_t current_nfthreads;
 
      MUTEX_LOCK(q_mutex);
      current_nfthreads = nfthreads;
-     max_nfthreads = new_count;
+     max_nfthreads = new_limit;
      MUTEX_UNLOCK(q_mutex);
 
-     if (current_nfthreads > new_count) {
+     if (current_nfthreads > new_limit) {
        for (i = 0; i < current_nfthreads; i++) {
          MUTEX_LOCK(q_mutex);
          COND_SIGNAL(q_cond);
@@ -61,8 +61,8 @@ decreased.
    main(int argc, char *argv)
    {
      /* ... */
-     grn_thread_set_get_count_func(groonga_get_thread_count, NULL);
-     grn_thread_set_set_count_func(groonga_set_thread_count, NULL);
+     grn_thread_set_get_limit_func(groonga_get_thread_limit, NULL);
+     grn_thread_set_set_limit_func(groonga_set_thread_limit, NULL);
 
      grn_init();
 
@@ -72,49 +72,49 @@ decreased.
 Reference
 ---------
 
-.. c:type:: uint32_t (*grn_thread_get_count_func)(void *data)
+.. c:type:: uint32_t (*grn_thread_get_limit_func)(void *data)
 
    It's the type of function that returns the max number of threads.
 
-.. c:type:: void (*grn_thread_set_count_func)(uint32_t new_count, void *data)
+.. c:type:: void (*grn_thread_set_limit_func)(uint32_t new_limit, void *data)
 
    It's the type of function that sets the max number of threads.
 
-.. c:function:: uint32_t grn_thread_get_count(void)
+.. c:function:: uint32_t grn_thread_get_limit(void)
 
    It returns the max number of threads.
 
-   If :c:type:`grn_thread_get_count_func` isn't set by
-   :c:func:`grn_thread_set_get_count_func()`, it always returns ``0``.
+   If :c:type:`grn_thread_get_limit_func` isn't set by
+   :c:func:`grn_thread_set_get_limit_func()`, it always returns ``0``.
 
    :return: The max number of threads or ``0``.
 
-.. c:function:: void_t grn_thread_set_count(uint32_t new_count)
+.. c:function:: void_t grn_thread_set_limit(uint32_t new_limit)
 
    It sets the max number of threads.
 
-   If :c:type:`grn_thread_set_count_func` isn't set by
-   :c:func:`grn_thread_set_set_count_func()`, it does nothing.
+   If :c:type:`grn_thread_set_limit_func` isn't set by
+   :c:func:`grn_thread_set_set_limit_func()`, it does nothing.
 
-   :param new_count: The new max number of threads.
+   :param new_limit: The new max number of threads.
 
-.. c:function:: void grn_thread_set_get_count_func(grn_thread_get_count_func func, void *data)
+.. c:function:: void grn_thread_set_get_limit_func(grn_thread_get_limit_func func, void *data)
 
    It sets the custom function that returns the max number of threads.
 
    ``data`` is passed to ``func`` when ``func`` is called from
-   :c:func:`grn_thread_get_count()`.
+   :c:func:`grn_thread_get_limit()`.
 
    :param func: The custom function that returns the max number of threads.
    :param data: An user data to be passed to ``func`` when ``func``
                 is called.
 
-.. c:function:: void grn_thread_set_set_count_func(grn_thread_set_count_func func, void *data)
+.. c:function:: void grn_thread_set_set_limit_func(grn_thread_set_limit_func func, void *data)
 
    It sets the custom function that sets the max number of threads.
 
    ``data`` is passed to ``func`` when ``func`` is called from
-   :c:func:`grn_thread_set_count()`.
+   :c:func:`grn_thread_set_limit()`.
 
    :param func: The custom function that sets the max number of threads.
    :param data: An user data to be passed to ``func`` when ``func``

  Modified: doc/source/reference/commands/database_unmap.rst (+4 -4)
===================================================================
--- doc/source/reference/commands/database_unmap.rst    2015-08-18 19:59:14 +0900 (c7e30aa)
+++ doc/source/reference/commands/database_unmap.rst    2015-08-18 20:13:02 +0900 (a2fba56)
@@ -6,7 +6,7 @@
 .. database: commands_database_unmap
 
 .. groonga-command
-.. thread_count 2
+.. thread_limit 2
 
 ``database_unmap``
 ==================
@@ -29,7 +29,7 @@ that releasing mapped memory.
 
 .. caution::
 
-   You can use this command only when :doc:`thread_count` returns
+   You can use this command only when :doc:`thread_limit` returns
    ``1``. It means that this command doesn't work with multithreading.
 
 Syntax
@@ -47,7 +47,7 @@ You can unmap database after you change the max number of threads to
 
 .. groonga-command
 .. include:: ../../example/reference/commands/database_unmap/usage_success.log
-.. thread_count --new_count 1
+.. thread_limit --max 1
 .. database_unmap
 
 If the max number of threads is larger than ``1``, ``database_unmap``
@@ -55,7 +55,7 @@ fails:
 
 .. groonga-command
 .. include:: ../../example/reference/commands/database_unmap/usage_failure.log
-.. thread_count --new_count 2
+.. thread_limit --max 2
 .. database_unmap
 
 Parameters

  Modified: doc/source/reference/commands/logical_parameters.rst (+1 -1)
===================================================================
--- doc/source/reference/commands/logical_parameters.rst    2015-08-18 19:59:14 +0900 (89cd922)
+++ doc/source/reference/commands/logical_parameters.rst    2015-08-18 20:13:02 +0900 (9f62ffb)
@@ -34,7 +34,7 @@ Here is a list of parameters:
    The parameters are independent in each thread. (To be exact, each
    :c:type:`grn_ctx`.) If you want to control the parameters
    perfectly, you should reduce the max number of threads to ``1`` by
-   :doc:`/reference/commands/thread_count` while you're using the
+   :doc:`/reference/commands/thread_limit` while you're using the
    parameters.
 
 Syntax

  Renamed: doc/source/reference/commands/thread_limit.rst (+26 -26) 57%
===================================================================
--- doc/source/reference/commands/thread_count.rst    2015-08-18 19:59:14 +0900 (58513cc)
+++ doc/source/reference/commands/thread_limit.rst    2015-08-18 20:13:02 +0900 (c1d99dc)
@@ -3,12 +3,12 @@
 .. highlightlang:: none
 
 .. groonga-command
-.. database: commands_thread_count
+.. database: commands_thread_limit
 
 .. groonga-command
-.. thread_count 2
+.. thread_limit 2
 
-``thread_count``
+``thread_limit``
 ================
 
 Summary
@@ -16,13 +16,13 @@ Summary
 
 .. versionadded:: 5.0.7
 
-``thread_count`` has the following two features:
+``thread_limit`` has the following two features:
 
   * It returns the max number of threads.
   * It sets the max number of threads.
 
 :doc:`/reference/executables/groonga` is the only Groonga server that
-supports full ``thread_count`` features.
+supports full ``thread_limit`` features.
 
 :doc:`/reference/executables/groonga-httpd` supports only one feature
 that returns the max number of threads. The max number of threads of
@@ -30,13 +30,13 @@ that returns the max number of threads. The max number of threads of
 because :doc:`/reference/executables/groonga-httpd` uses single thread
 model.
 
-If you're using Groonga as a library, ``thread_count`` doesn't work
+If you're using Groonga as a library, ``thread_limit`` doesn't work
 without you set custom functions by
-:c:func:`grn_thread_set_get_count_func()` and
-:c:func:`grn_thread_set_set_count_func()`. If you set a function by
-:c:func:`grn_thread_set_get_count_func()`, the feature that returns
+:c:func:`grn_thread_set_get_limit_func()` and
+:c:func:`grn_thread_set_set_limit_func()`. If you set a function by
+:c:func:`grn_thread_set_get_limit_func()`, the feature that returns
 the max number of threads works. If you set a function by
-:c:func:`grn_thread_set_set_count_func()`, the feature that sets the
+:c:func:`grn_thread_set_set_limit_func()`, the feature that sets the
 max number of threads works.
 
 Syntax
@@ -44,7 +44,7 @@ Syntax
 
 This command takes only one optional parameter::
 
-  thread_count [new_count=null]
+  thread_limit [max=null]
 
 Usage
 -----
@@ -52,19 +52,19 @@ Usage
 You can get the max number of threads by calling without any parameters:
 
 .. groonga-command
-.. include:: ../../example/reference/commands/thread_count/usage_get.log
-.. thread_count
+.. include:: ../../example/reference/commands/thread_limit/usage_get.log
+.. thread_limit
 
 If it returns ``0``, your Groonga server doesn't support the feature.
 
-You can set the max number of threads by calling ``new_count`` parameter:
+You can set the max number of threads by calling ``max`` parameter:
 
 .. groonga-command
-.. include:: ../../example/reference/commands/thread_count/usage_set.log
-.. thread_count --new_count 4
+.. include:: ../../example/reference/commands/thread_limit/usage_set.log
+.. thread_limit --max 4
 
 It returns the previous max number of threads when you pass
-``new_count`` parameter.
+``max`` parameter.
 
 Parameters
 ----------
@@ -81,21 +81,21 @@ Optional parameters
 
 There is one optional parameter.
 
-.. _thread-count-new-count:
+.. _thread-limit-max:
 
-``new_count``
-"""""""""""""
+``max``
+"""""""
 
 Specifies the new max number of threads.
 
 You must specify positive integer:
 
 .. groonga-command
-.. include:: ../../example/reference/commands/thread_count/new_count.log
-.. thread_count --new_count 3
+.. include:: ../../example/reference/commands/thread_limit/max.log
+.. thread_limit --max 3
 
-If you specify ``new_count`` parameter, ``thread_count`` returns the
-max number of threads before ``new_count`` is applied.
+If you specify ``max`` parameter, ``thread_limit`` returns the
+max number of threads before ``max`` is applied.
 
 Return value
 ------------
@@ -104,7 +104,7 @@ The command returns the max number of threads as body::
 
   [HEADER, N_MAX_THREADS]
 
-If ``new_count`` is specified, ``N_MAX_THREADS`` is the max number of
-threads before ``new_count`` is applied.
+If ``max`` is specified, ``N_MAX_THREADS`` is the max number of
+threads before ``max`` is applied.
 
 See :doc:`/reference/command/output_format` for ``HEADER``.

  Modified: include/groonga/thread.h (+6 -6)
===================================================================
--- include/groonga/thread.h    2015-08-18 19:59:14 +0900 (ebea80b)
+++ include/groonga/thread.h    2015-08-18 20:13:02 +0900 (011111f)
@@ -24,15 +24,15 @@
 extern "C" {
 #endif
 
-GRN_API uint32_t grn_thread_get_count(void);
-GRN_API void grn_thread_set_count(uint32_t new_count);
+GRN_API uint32_t grn_thread_get_limit(void);
+GRN_API void grn_thread_set_limit(uint32_t new_limit);
 
 
-typedef uint32_t (*grn_thread_get_count_func)(void *data);
-GRN_API void grn_thread_set_get_count_func(grn_thread_get_count_func func,
+typedef uint32_t (*grn_thread_get_limit_func)(void *data);
+GRN_API void grn_thread_set_get_limit_func(grn_thread_get_limit_func func,
                                            void *data);
-typedef void (*grn_thread_set_count_func)(uint32_t new_count, void *data);
-GRN_API void grn_thread_set_set_count_func(grn_thread_set_count_func func,
+typedef void (*grn_thread_set_limit_func)(uint32_t new_limit, void *data);
+GRN_API void grn_thread_set_set_limit_func(grn_thread_set_limit_func func,
                                            void *data);
 
 #ifdef __cplusplus

  Modified: lib/proc.c (+29 -30)
===================================================================
--- lib/proc.c    2015-08-18 19:59:14 +0900 (c02ef6d)
+++ lib/proc.c    2015-08-18 20:13:02 +0900 (4450abf)
@@ -6880,39 +6880,38 @@ proc_object_exist(grn_ctx *ctx, int nargs, grn_obj **args,
 }
 
 static grn_obj *
-proc_thread_count(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
+proc_thread_limit(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
 {
-  grn_obj *new_count_bulk;
-  uint32_t current_count;
+  grn_obj *max_bulk;
+  uint32_t current_limit;
 
-  current_count = grn_thread_get_count();
-  GRN_OUTPUT_INT64(current_count);
+  current_limit = grn_thread_get_limit();
+  GRN_OUTPUT_INT64(current_limit);
 
-  new_count_bulk = VAR(0);
-  if (GRN_TEXT_LEN(new_count_bulk) > 0) {
-    uint32_t new_count;
-    const char *new_count_text = GRN_TEXT_VALUE(new_count_bulk);
-    const char *new_count_text_end;
-    const char *new_count_text_rest;
+  max_bulk = VAR(0);
+  if (GRN_TEXT_LEN(max_bulk) > 0) {
+    uint32_t max;
+    const char *max_text = GRN_TEXT_VALUE(max_bulk);
+    const char *max_text_end;
+    const char *max_text_rest;
 
-    new_count_text_end = new_count_text + GRN_TEXT_LEN(new_count_bulk);
-    new_count = grn_atoui(new_count_text, new_count_text_end,
-                          &new_count_text_rest);
-    if (new_count_text_rest != new_count_text_end) {
+    max_text_end = max_text + GRN_TEXT_LEN(max_bulk);
+    max = grn_atoui(max_text, max_text_end, &max_text_rest);
+    if (max_text_rest != max_text_end) {
       ERR(GRN_INVALID_ARGUMENT,
-          "[thread_count] new_count must be unsigned integer value: <%.*s>",
-          (int)GRN_TEXT_LEN(new_count_bulk),
-          new_count_text);
+          "[thread_limit] max must be unsigned integer value: <%.*s>",
+          (int)GRN_TEXT_LEN(max_bulk),
+          max_text);
       return NULL;
     }
-    if (new_count == 0) {
+    if (max == 0) {
       ERR(GRN_INVALID_ARGUMENT,
-          "[thread_count] new_count must be 1 or larger: <%.*s>",
-          (int)GRN_TEXT_LEN(new_count_bulk),
-          new_count_text);
+          "[thread_limit] max must be 1 or larger: <%.*s>",
+          (int)GRN_TEXT_LEN(max_bulk),
+          max_text);
       return NULL;
     }
-    grn_thread_set_count(new_count);
+    grn_thread_set_limit(max);
   }
 
   return NULL;
@@ -6923,13 +6922,13 @@ proc_database_unmap(grn_ctx *ctx, int nargs, grn_obj **args,
                     grn_user_data *user_data)
 {
   grn_rc rc;
-  uint32_t current_count;
+  uint32_t current_limit;
 
-  current_count = grn_thread_get_count();
-  if (current_count != 1) {
+  current_limit = grn_thread_get_limit();
+  if (current_limit != 1) {
     ERR(GRN_OPERATION_NOT_PERMITTED,
-        "[database_unmap] the number of threads must be 1: <%u>",
-        current_count);
+        "[database_unmap] the max number of threads must be 1: <%u>",
+        current_limit);
     GRN_OUTPUT_BOOL(GRN_FALSE);
     return NULL;
   }
@@ -7515,8 +7514,8 @@ grn_db_init_builtin_query(grn_ctx *ctx)
   DEF_VAR(vars[0], "name");
   DEF_COMMAND("object_exist", proc_object_exist, 1, vars);
 
-  DEF_VAR(vars[0], "new_count");
-  DEF_COMMAND("thread_count", proc_thread_count, 1, vars);
+  DEF_VAR(vars[0], "max");
+  DEF_COMMAND("thread_limit", proc_thread_limit, 1, vars);
 
   DEF_COMMAND("database_unmap", proc_database_unmap, 0, vars);
 

  Modified: lib/thread.c (+16 -16)
===================================================================
--- lib/thread.c    2015-08-18 19:59:14 +0900 (f55e4ab)
+++ lib/thread.c    2015-08-18 20:13:02 +0900 (c598b7a)
@@ -18,42 +18,42 @@
 
 #include "grn_ctx.h"
 
-static grn_thread_get_count_func get_count_func = NULL;
-static void *get_count_func_data = NULL;
-static grn_thread_set_count_func set_count_func = NULL;
-static void *set_count_func_data = NULL;
+static grn_thread_get_limit_func get_limit_func = NULL;
+static void *get_limit_func_data = NULL;
+static grn_thread_set_limit_func set_limit_func = NULL;
+static void *set_limit_func_data = NULL;
 
 uint32_t
-grn_thread_get_count(void)
+grn_thread_get_limit(void)
 {
-  if (get_count_func) {
-    return get_count_func(get_count_func_data);
+  if (get_limit_func) {
+    return get_limit_func(get_limit_func_data);
   } else {
     return 0;
   }
 }
 
 void
-grn_thread_set_count(uint32_t new_count)
+grn_thread_set_limit(uint32_t new_limit)
 {
-  if (!set_count_func) {
+  if (!set_limit_func) {
     return;
   }
 
-  set_count_func(new_count, set_count_func_data);
+  set_limit_func(new_limit, set_limit_func_data);
 }
 
 void
-grn_thread_set_get_count_func(grn_thread_get_count_func func,
+grn_thread_set_get_limit_func(grn_thread_get_limit_func func,
                               void *data)
 {
-  get_count_func = func;
-  get_count_func_data = data;
+  get_limit_func = func;
+  get_limit_func_data = data;
 }
 
 void
-grn_thread_set_set_count_func(grn_thread_set_count_func func, void *data)
+grn_thread_set_set_limit_func(grn_thread_set_limit_func func, void *data)
 {
-  set_count_func = func;
-  set_count_func_data = data;
+  set_limit_func = func;
+  set_limit_func_data = data;
 }

  Modified: src/groonga.c (+6 -6)
===================================================================
--- src/groonga.c    2015-08-18 19:59:14 +0900 (50cf20b)
+++ src/groonga.c    2015-08-18 20:13:02 +0900 (5712dd6)
@@ -481,23 +481,23 @@ static grn_cond q_cond;
 static uint32_t nthreads = 0, nfthreads = 0, max_nfthreads;
 
 static uint32_t
-groonga_get_thread_count(void *data)
+groonga_get_thread_limit(void *data)
 {
   return max_nfthreads;
 }
 
 static void
-groonga_set_thread_count(uint32_t new_count, void *data)
+groonga_set_thread_limit(uint32_t new_limit, void *data)
 {
   uint32_t i;
   uint32_t current_nfthreads;
 
   MUTEX_LOCK(q_mutex);
   current_nfthreads = nfthreads;
-  max_nfthreads = new_count;
+  max_nfthreads = new_limit;
   MUTEX_UNLOCK(q_mutex);
 
-  if (current_nfthreads > new_count) {
+  if (current_nfthreads > new_limit) {
     for (i = 0; i < current_nfthreads; i++) {
       MUTEX_LOCK(q_mutex);
       COND_SIGNAL(q_cond);
@@ -3036,8 +3036,8 @@ main(int argc, char **argv)
     }
   }
 
-  grn_thread_set_get_count_func(groonga_get_thread_count, NULL);
-  grn_thread_set_set_count_func(groonga_set_thread_count, NULL);
+  grn_thread_set_get_limit_func(groonga_get_thread_limit, NULL);
+  grn_thread_set_set_limit_func(groonga_set_thread_limit, NULL);
 
   if (input_path) {
     if (!freopen(input_path, "r", stdin)) {

  Modified: src/httpd/nginx-module/ngx_http_groonga_module.c (+2 -2)
===================================================================
--- src/httpd/nginx-module/ngx_http_groonga_module.c    2015-08-18 19:59:14 +0900 (8b83ec0)
+++ src/httpd/nginx-module/ngx_http_groonga_module.c    2015-08-18 20:13:02 +0900 (4012daf)
@@ -134,7 +134,7 @@ ngx_str_is_custom_path(ngx_str_t *string)
 }
 
 static uint32_t
-ngx_http_groonga_get_thread_count(void *data)
+ngx_http_groonga_get_thread_limit(void *data)
 {
   return 1;
 }
@@ -1491,7 +1491,7 @@ ngx_http_groonga_init_process(ngx_cycle_t *cycle)
   ngx_http_conf_ctx_t *http_conf;
   ngx_http_groonga_database_callback_data_t data;
 
-  grn_thread_set_get_count_func(ngx_http_groonga_get_thread_count, NULL);
+  grn_thread_set_get_limit_func(ngx_http_groonga_get_thread_limit, NULL);
 
   rc = grn_init();
   if (rc != GRN_SUCCESS) {
-------------- next part --------------
HTML����������������������������...
Download 



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