非结构化接口线程安全

This commit is contained in:
zhangchengwei
2018-09-29 11:28:09 +08:00
committed by zhengchao
parent 27d7b503c7
commit 09a3d6598d
5 changed files with 41 additions and 15 deletions

View File

@@ -54,6 +54,7 @@ void tango_cache_get_statistics(const struct tango_cache_instance *instance, str
out->del_recv_num = instance->statistic.del_recv_num;
out->del_succ_num = instance->statistic.del_succ_num;
out->del_error_num= instance->statistic.del_error_num;
out->totaldrop_num= instance->statistic.totaldrop_num;
out->session_num = instance->statistic.session_num;
out->memory_used = instance->statistic.memory_used;
}
@@ -245,8 +246,6 @@ struct tango_cache_ctx *tango_cache_update_prepare(struct tango_cache_instance *
instance->error_code = CACHE_OUTOF_MEMORY;
return NULL;
}
instance->statistic.put_recv_num += 1;
instance->error_code = CACHE_OK;
ctx = (struct tango_cache_ctx *)calloc(1, sizeof(struct tango_cache_ctx));
ctx->instance = instance;
@@ -301,6 +300,8 @@ struct tango_cache_ctx *tango_cache_update_prepare(struct tango_cache_instance *
free(p);
}
ctx->put.evbuf = evbuffer_new();
TAILQ_INIT(&ctx->put.etag_head);
return ctx;
}
@@ -313,9 +314,8 @@ struct tango_cache_ctx *tango_cache_update_start(struct tango_cache_instance *in
{
return NULL;
}
ctx->put.evbuf = evbuffer_new();
TAILQ_INIT(&ctx->put.etag_head);
ctx->instance->statistic.put_recv_num += 1;
ctx->instance->error_code = CACHE_OK;
return ctx;
}
@@ -367,7 +367,6 @@ struct tango_cache_ctx *tango_cache_fetch_prepare(struct tango_cache_instance *i
ctx->get.state = GET_STATE_START;
ctx->get.max_age = meta->get.max_age;
ctx->get.min_fresh = meta->get.min_fresh;
instance->statistic.get_recv_num += 1;
if(instance->hash_object_key)
{
@@ -396,7 +395,6 @@ struct tango_cache_ctx *tango_cache_delete_prepare(struct tango_cache_instance *
ctx->instance = instance;
ctx->future = future;
ctx->method = CACHE_REQUEST_DELETE;
instance->statistic.del_recv_num += 1;
if(instance->hash_object_key)
{