diff options
| author | Zheng Chao <[email protected]> | 2023-09-14 18:53:31 +0800 |
|---|---|---|
| committer | Zheng Chao <[email protected]> | 2023-09-14 18:53:31 +0800 |
| commit | ecac77c3aa3a65d11c65253cee35de96c2cec6c8 (patch) | |
| tree | 44a37fe78329f8883866c9a00e68eb9f873d155f /examples | |
| parent | da7d76bd764dd71f32f8af7a515cec121ced9991 (diff) | |
Optimize performance AsyncExec test case
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/async_example.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/examples/async_example.c b/examples/async_example.c index 5149bcf..b68f1cd 100644 --- a/examples/async_example.c +++ b/examples/async_example.c @@ -32,16 +32,12 @@ int main(int argc, char **argv) free(err); return -1; } + swarmkv_register_thread(db[i]); } struct my_context *ctx=NULL; ctx=(struct my_context*)calloc(sizeof(struct my_context), 1); swarmkv_async_command(db[0], my_on_reply_callback, ctx, "HSET uid001 name zhangsan age 18"); - - while(!ctx->got_reply) - { - //do something else - sleep(1); - } + swarmkv_caller_loop(db[0], SWARMKV_LOOP_ONCE, NULL); printf("HSET %lld items\n", ctx->reply_integer); free(ctx); for(size_t i=0; i<2; i++) |
