Kouhei Sutou
null+****@clear*****
Wed Mar 16 18:24:27 JST 2016
Kouhei Sutou 2016-03-16 18:24:27 +0900 (Wed, 16 Mar 2016) New Revision: b56f3f072e5717a3d72eb48d0b65206ddfd03559 https://github.com/groonga/groonga/commit/b56f3f072e5717a3d72eb48d0b65206ddfd03559 Message: Use special error code for cancel Modified files: include/groonga/groonga.h lib/ctx.c lib/grn_ctx.h lib/request_canceler.c Modified: include/groonga/groonga.h (+2 -1) =================================================================== --- include/groonga/groonga.h 2016-03-16 00:03:19 +0900 (a3d2880) +++ include/groonga/groonga.h 2016-03-16 18:24:27 +0900 (f4729d1) @@ -124,7 +124,8 @@ typedef enum { GRN_TOKEN_FILTER_ERROR = -73, GRN_COMMAND_ERROR = -74, GRN_PLUGIN_ERROR = -75, - GRN_SCORER_ERROR = -76 + GRN_SCORER_ERROR = -76, + GRN_CANCEL = -77 } grn_rc; GRN_API grn_rc grn_init(void); Modified: lib/ctx.c (+1 -1) =================================================================== --- lib/ctx.c 2016-03-16 00:03:19 +0900 (1e33e16) +++ lib/ctx.c 2016-03-16 18:24:27 +0900 (f943d81) @@ -1701,7 +1701,7 @@ grn_ctx_send(grn_ctx *ctx, const char *str, unsigned int str_len, int flags) } if (ctx->stat == GRN_CTX_QUITTING) { ctx->stat = GRN_CTX_QUIT; } if (ctx->impl->qe_next) { - if (ctx->rc != GRN_INTERRUPTED_FUNCTION_CALL) { + if (ctx->rc != GRN_CANCEL) { ERRCLR(ctx); } } else { Modified: lib/grn_ctx.h (+1 -1) =================================================================== --- lib/grn_ctx.h 2016-03-16 00:03:19 +0900 (7ac1efc) +++ lib/grn_ctx.h 2016-03-16 18:24:27 +0900 (c843bf7) @@ -45,7 +45,7 @@ extern "C" { (ctx)->subno++;\ } else {\ (ctx)->errlvl = GRN_OK;\ - if ((ctx)->rc != GRN_INTERRUPTED_FUNCTION_CALL) {\ + if ((ctx)->rc != GRN_CANCEL) {\ (ctx)->rc = GRN_SUCCESS;\ }\ (ctx)->seqno++;\ Modified: lib/request_canceler.c (+3 -3) =================================================================== --- lib/request_canceler.c 2016-03-16 00:03:19 +0900 (9b9dfde) +++ lib/request_canceler.c 2016-03-16 18:24:27 +0900 (b3591d3) @@ -84,7 +84,7 @@ grn_request_canceler_unregister(grn_ctx *ctx, } MUTEX_UNLOCK(grn_the_request_canceler->mutex); - if (ctx->rc == GRN_INTERRUPTED_FUNCTION_CALL) { + if (ctx->rc == GRN_CANCEL) { ERRSET(ctx, GRN_LOG_NOTICE, ctx->rc, "[request-canceler] a request is canceled: <%.*s>", size, request_id); @@ -102,7 +102,7 @@ grn_request_canceler_cancel(const char *request_id, unsigned int size) if (grn_hash_get(&grn_gctx, entries, request_id, size, &value)) { grn_request_canceler_entry *entry = value; if (entry->ctx->rc == GRN_SUCCESS) { - entry->ctx->rc = GRN_INTERRUPTED_FUNCTION_CALL; + entry->ctx->rc = GRN_CANCEL; canceled = GRN_TRUE; } } @@ -130,7 +130,7 @@ grn_request_canceler_cancel_all(void) if (grn_hash_cursor_get_value(ctx, cursor, &value) > 0) { grn_request_canceler_entry *entry = value; if (entry->ctx->rc == GRN_SUCCESS) { - entry->ctx->rc = GRN_INTERRUPTED_FUNCTION_CALL; + entry->ctx->rc = GRN_CANCEL; canceled = GRN_TRUE; } } -------------- next part -------------- HTML����������������������������...下载