[Groonga-commit] groonga/groonga [master] table: add queue stuff to grn_hash.

Back to archive index

null+****@clear***** null+****@clear*****
2012年 6月 15日 (金) 17:39:54 JST


Daijiro MORI	2012-06-15 17:39:54 +0900 (Fri, 15 Jun 2012)

  New Revision: bb2c5475ca0cb0465f54ab9b201569373b304bcc

  Log:
    table: add queue stuff to grn_hash.

  Modified files:
    lib/hash.c
    lib/hash.h

  Modified: lib/hash.c (+1 -0)
===================================================================
--- lib/hash.c    2012-06-15 15:57:11 +0900 (ab5fc33)
+++ lib/hash.c    2012-06-15 17:39:54 +0900 (0e83e5c)
@@ -1482,6 +1482,7 @@ grn_io_hash_init(grn_ctx *ctx, grn_hash *hash, const char *path,
   header->n_entries = 0;
   header->n_garbages = 0;
   header->tokenizer = GRN_ID_NIL;
+  grn_table_queue_init(ctx, &header->queue);
 
   hash->obj.header.flags = flags;
   hash->ctx = ctx;

  Modified: lib/hash.h (+17 -16)
===================================================================
--- lib/hash.h    2012-06-15 15:57:11 +0900 (ded36fc)
+++ lib/hash.h    2012-06-15 17:39:54 +0900 (002dd97)
@@ -167,6 +167,22 @@ grn_rc grn_array_truncate(grn_ctx *ctx, grn_array *array);
 grn_rc grn_array_copy_sort_key(grn_ctx *ctx, grn_array *array,
                                grn_table_sort_key *keys, int n_keys);
 
+/* grn_table_queue */
+
+typedef struct _grn_table_queue grn_table_queue;
+
+struct _grn_table_queue {
+  grn_mutex mutex;
+  grn_cond cond;
+  grn_id head;
+  grn_id tail;
+  grn_id cap;
+};
+
+void grn_array_queue_lock_clear(grn_ctx *ctx, grn_array *array);
+void grn_array_clear_curr_rec(grn_ctx *ctx, grn_array *array);
+grn_table_queue *grn_array_queue(grn_ctx *ctx, grn_array *array);
+
 /**** grn_hash ****/
 
 #define GRN_HASH_TINY         (0x01<<6)
@@ -228,6 +244,7 @@ struct grn_hash_header {
   uint32_t lock;
   uint32_t reserved[16];
   grn_id garbages[GRN_HASH_MAX_KEY_SIZE];
+  grn_table_queue queue;
 };
 
 struct _grn_hash_cursor {
@@ -278,22 +295,6 @@ grn_rc grn_hash_clear_lock(grn_ctx *ctx, grn_hash *hash);
 
 #define GRN_HASH_SIZE(hash) (*((hash)->n_entries))
 
-/* grn_table_queue */
-
-typedef struct _grn_table_queue grn_table_queue;
-
-struct _grn_table_queue {
-  grn_mutex mutex;
-  grn_cond cond;
-  grn_id head;
-  grn_id tail;
-  grn_id cap;
-};
-
-void grn_array_queue_lock_clear(grn_ctx *ctx, grn_array *array);
-void grn_array_clear_curr_rec(grn_ctx *ctx, grn_array *array);
-grn_table_queue *grn_array_queue(grn_ctx *ctx, grn_array *array);
-
 /* private */
 typedef enum {
   grn_rec_document = 0,




Groonga-commit メーリングリストの案内
Back to archive index