From 1a92c4b28214c9f39a767f1624a681cfc90f7501 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Fri, 30 Oct 2015 11:25:48 -0700 Subject: [PATCH] rgw: RGWCoroutine::spawn() returns stack Signed-off-by: Yehuda Sadeh --- src/rgw/rgw_coroutine.cc | 14 ++++++++------ src/rgw/rgw_coroutine.h | 6 +++--- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/rgw/rgw_coroutine.cc b/src/rgw/rgw_coroutine.cc index c89cd6902ecd7..957e91a62dc5e 100644 --- a/src/rgw/rgw_coroutine.cc +++ b/src/rgw/rgw_coroutine.cc @@ -166,10 +166,10 @@ int RGWCoroutinesStack::call(RGWCoroutine *next_op, int ret) { return ret; } -void RGWCoroutinesStack::spawn(RGWCoroutine *source_op, RGWCoroutine *op, bool wait) +RGWCoroutinesStack *RGWCoroutinesStack::spawn(RGWCoroutine *source_op, RGWCoroutine *op, bool wait) { if (!op) { - return; + return NULL; } op->get(); @@ -188,11 +188,13 @@ void RGWCoroutinesStack::spawn(RGWCoroutine *source_op, RGWCoroutine *op, bool w if (wait) { set_blocked_by(stack); } + + return stack; } -void RGWCoroutinesStack::spawn(RGWCoroutine *op, bool wait) +RGWCoroutinesStack *RGWCoroutinesStack::spawn(RGWCoroutine *op, bool wait) { - spawn(NULL, op, wait); + return spawn(NULL, op, wait); } int RGWCoroutinesStack::wait(const utime_t& interval) @@ -485,9 +487,9 @@ int RGWCoroutine::call(RGWCoroutine *op) return 0; } -void RGWCoroutine::spawn(RGWCoroutine *op, bool wait) +RGWCoroutinesStack *RGWCoroutine::spawn(RGWCoroutine *op, bool wait) { - stack->spawn(this, op, wait); + return stack->spawn(this, op, wait); } bool RGWCoroutine::collect(int *ret) /* returns true if needs to be called again */ diff --git a/src/rgw/rgw_coroutine.h b/src/rgw/rgw_coroutine.h index 69e11792874d3..74f2bb32c402d 100644 --- a/src/rgw/rgw_coroutine.h +++ b/src/rgw/rgw_coroutine.h @@ -181,7 +181,7 @@ public: } int call(RGWCoroutine *op); /* call at the same stack we're in */ - void spawn(RGWCoroutine *op, bool wait); /* execute on a different stack */ + RGWCoroutinesStack *spawn(RGWCoroutine *op, bool wait); /* execute on a different stack */ bool collect(int *ret); /* returns true if needs to be called again */ bool collect_next(int *ret, RGWCoroutinesStack **collected_stack = NULL); /* returns true if found a stack to collect */ @@ -281,7 +281,7 @@ protected: RGWCoroutinesEnv *env; RGWCoroutinesStack *parent; - void spawn(RGWCoroutine *source_op, RGWCoroutine *next_op, bool wait); + RGWCoroutinesStack *spawn(RGWCoroutine *source_op, RGWCoroutine *next_op, bool wait); bool collect(RGWCoroutine *op, int *ret); /* returns true if needs to be called again */ bool collect_next(RGWCoroutine *op, int *ret, RGWCoroutinesStack **collected_stack); /* returns true if found a stack to collect */ public: @@ -346,7 +346,7 @@ public: string error_str(); int call(RGWCoroutine *next_op, int ret = 0); - void spawn(RGWCoroutine *next_op, bool wait); + RGWCoroutinesStack *spawn(RGWCoroutine *next_op, bool wait); int unwind(int retcode); int wait(const utime_t& interval); -- 2.39.5