diff options
author | dormando <dormando@rydia.net> | 2021-07-30 15:06:05 -0700 |
---|---|---|
committer | dormando <dormando@rydia.net> | 2021-08-09 17:09:08 -0700 |
commit | 57493bfca4d16f19aa6d591d29f19f3d2ad160f8 (patch) | |
tree | 24f78fa1f5b5842be2cf2ca7f108367f198d610c /storage.c | |
parent | c25d0bd68ab0f6226c2d979bf0951923624926dd (diff) | |
download | memcached-57493bfca4d16f19aa6d591d29f19f3d2ad160f8.tar.gz |
core: io_queue_t flow mode
instead of passing ownership of (io_queue_t)*q to the side thread,
instead the ownership of IO objects are passed to the side thread, which
are then individually returned. The worker thread runs return_cb() on
each, determining when it's done with the response batch.
this interface could use more explicit functions to make it more clear.
Ownership of *q isn't actually "passed" anywhere, it's just used or not
used depending on which return function the owner wants.
Diffstat (limited to 'storage.c')
-rw-r--r-- | storage.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -366,9 +366,9 @@ int storage_get_item(conn *c, item *it, mc_resp *resp) { return 0; } -void storage_submit_cb(void *ctx, void *stack) { +void storage_submit_cb(io_queue_t *q) { // Don't need to do anything special for extstore. - extstore_submit(ctx, stack); + extstore_submit(q->ctx, q->stack_ctx); } static void recache_or_free(io_pending_t *pending) { @@ -446,12 +446,14 @@ static void recache_or_free(io_pending_t *pending) { // TODO: stubbed with a reminder: should be able to move most of the extstore // callback code into this code instead, executing on worker thread instead of // IO thread. -void storage_complete_cb(void *ctx, void *stack_ctx) { +void storage_complete_cb(io_queue_t *q) { + // need to reset the stack for next use. + q->stack_ctx = NULL; return; } // Called after responses have been transmitted. Need to free up related data. -void storage_finalize_cb(io_pending_t *pending) { +int storage_finalize_cb(io_pending_t *pending) { recache_or_free(pending); io_pending_storage_t *p = (io_pending_storage_t *)pending; obj_io *io = &p->io_ctx; @@ -461,6 +463,7 @@ void storage_finalize_cb(io_pending_t *pending) { io->iov = NULL; } // don't need to free the main context, since it's embedded. + return 0; // return code ignored. } /* |