Kouhei Sutou
null+****@clear*****
Tue Nov 20 10:16:32 JST 2012
Kouhei Sutou 2012-11-20 10:16:32 +0900 (Tue, 20 Nov 2012) New Revision: b0e76da4b615625f2790ba4610c59eab7b552f05 https://github.com/groonga/groonga/commit/b0e76da4b615625f2790ba4610c59eab7b552f05 Log: tokenizer: add grn_plugin_mutex_{open,close}() Because API consistency. open/close pair is used for creating/freeing object in groonga. grn_plugin_mutex_{create,destroy}() were deprecated. Modified files: include/groonga/plugin.h lib/plugin.c Modified: include/groonga/plugin.h (+15 -3) =================================================================== --- include/groonga/plugin.h 2012-11-20 10:11:29 +0900 (b434d34) +++ include/groonga/plugin.h 2012-11-20 10:16:32 +0900 (648e36e) @@ -126,17 +126,29 @@ void grn_plugin_logtrace(grn_ctx *ctx, grn_log_level level); typedef struct _grn_plugin_mutex grn_plugin_mutex; /* - grn_plugin_mutex_create() returns a pointer to a new object of + grn_plugin_mutex_open() returns a pointer to a new object of grn_plugin_mutex. Memory for the new object is obtained with - GRN_PLUGIN_MALLOC(). grn_plugin_mutex_create() returns NULL if sufficient + GRN_PLUGIN_MALLOC(). grn_plugin_mutex_open() returns NULL if sufficient memory is not available. */ +grn_plugin_mutex *grn_plugin_mutex_open(grn_ctx *ctx); + +/* + grn_plugin_mutex_create() is deprecated. Use grn_plugin_mutex_open() + instead. +*/ grn_plugin_mutex *grn_plugin_mutex_create(grn_ctx *ctx); /* - grn_plugin_mutex_destroy() finalizes an object of grn_plugin_mutex and then + grn_plugin_mutex_close() finalizes an object of grn_plugin_mutex and then frees memory allocated for that object. */ +void grn_plugin_mutex_close(grn_ctx *ctx, grn_plugin_mutex *mutex); + +/* + grn_plugin_mutex_destroy() is deprecated. Use grn_plugin_mutex_close() + instead. +*/ void grn_plugin_mutex_destroy(grn_ctx *ctx, grn_plugin_mutex *mutex); /* Modified: lib/plugin.c (+14 -2) =================================================================== --- lib/plugin.c 2012-11-20 10:11:29 +0900 (0cf1a1c) +++ lib/plugin.c 2012-11-20 10:16:32 +0900 (798634e) @@ -489,7 +489,7 @@ struct _grn_plugin_mutex { }; grn_plugin_mutex * -grn_plugin_mutex_create(grn_ctx *ctx) +grn_plugin_mutex_open(grn_ctx *ctx) { grn_plugin_mutex * const mutex = GRN_PLUGIN_MALLOC(ctx, sizeof(grn_plugin_mutex)); @@ -499,8 +499,14 @@ grn_plugin_mutex_create(grn_ctx *ctx) return mutex; } +grn_plugin_mutex * +grn_plugin_mutex_create(grn_ctx *ctx) +{ + return grn_plugin_mutex_open(ctx); +} + void -grn_plugin_mutex_destroy(grn_ctx *ctx, grn_plugin_mutex *mutex) +grn_plugin_mutex_close(grn_ctx *ctx, grn_plugin_mutex *mutex) { if (mutex != NULL) { CRITICAL_SECTION_FIN(mutex->critical_section); @@ -509,6 +515,12 @@ grn_plugin_mutex_destroy(grn_ctx *ctx, grn_plugin_mutex *mutex) } void +grn_plugin_mutex_destroy(grn_ctx *ctx, grn_plugin_mutex *mutex) +{ + grn_plugin_mutex_close(ctx, mutex); +} + +void grn_plugin_mutex_lock(grn_ctx *ctx, grn_plugin_mutex *mutex) { if (mutex != NULL) { -------------- next part -------------- HTML����������������������������...Download