From 0e5c7b633b98c6df6041dd12da4a7757df2c28fe Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 24 Nov 2008 14:06:49 -0800 Subject: [PATCH] context: all C_Gather to OR instead of AND subs. That is, call completion when first sub completes. --- src/include/Context.h | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/include/Context.h b/src/include/Context.h index ddacd3bc8c44d..5a5cc72a6eca1 100644 --- a/src/include/Context.h +++ b/src/include/Context.h @@ -107,6 +107,8 @@ public: }; + + /* * C_Gather * @@ -118,13 +120,22 @@ public: //cout << "C_Gather sub_finish " << this << " got " << r << " of " << waitfor << endl; assert(waitfor.count(r)); waitfor.erase(r); + + if (any && onfinish) { + onfinish->finish(0); + delete onfinish; + onfinish = 0; + } + if (!waitfor.empty()) return false; // more subs left // last one - onfinish->finish(0); - delete onfinish; - onfinish = 0; + if (!any && onfinish) { + onfinish->finish(0); + delete onfinish; + onfinish = 0; + } return true; } @@ -149,9 +160,10 @@ private: Context *onfinish; std::set waitfor; int num; + bool any; /* if true, OR, otherwise, AND */ public: - C_Gather(Context *f=0) : onfinish(f), num(0) { + C_Gather(Context *f=0, bool an=false) : onfinish(f), num(0), any(an) { //cout << "C_Gather new " << this << endl; } ~C_Gather() { -- 2.39.5