From: Taiyuan Zhang Date: Thu, 21 Apr 2016 22:42:26 +0000 (-0700) Subject: fix cancelAllFunctions X-Git-Tag: 2016.07.26~333 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=ba7c9b403a6a3978ff4a186246f7ee1434ca77b3;p=folly.git fix cancelAllFunctions Summary: as titled. When I tried re-adding all functions after cancelAllFunctions, it throws error. This is because it doesn't reset currentFunction to null. Reviewed By: jjs0 Differential Revision: D3209237 fb-gh-sync-id: 5b6e2d967fc3c0986320d23b8d61eb1bfbff8940 fbshipit-source-id: 5b6e2d967fc3c0986320d23b8d61eb1bfbff8940 --- diff --git a/folly/experimental/FunctionScheduler.cpp b/folly/experimental/FunctionScheduler.cpp index de90c482..6727ca35 100644 --- a/folly/experimental/FunctionScheduler.cpp +++ b/folly/experimental/FunctionScheduler.cpp @@ -223,6 +223,7 @@ void FunctionScheduler::cancelFunction(const std::unique_lock& l, void FunctionScheduler::cancelAllFunctions() { std::unique_lock l(mutex_); functions_.clear(); + currentFunction_ = nullptr; } bool FunctionScheduler::resetFunctionTimer(StringPiece nameID) {