add cancelFunctionAndWait and cancelAllFunctionsAndWait to FunctionScheduler
authorJunlin Zhang <neicullyn@fb.com>
Fri, 16 Dec 2016 23:07:47 +0000 (15:07 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Fri, 16 Dec 2016 23:18:06 +0000 (15:18 -0800)
commit2a7bf4845898201b7d6845502e6b275573cc9337
treed4b734c9f6d250a0b5ee78389331e3642a5a9ffd
parent2b06a7168bbcbb11384350d918767ab1804b9cdc
add cancelFunctionAndWait and cancelAllFunctionsAndWait to FunctionScheduler

Summary: In FunctionScheduler, cancelFunction and cancelAllFunction will not wait for current running function, which will lead to segmentation fault if the function captures resource to be destructed right after calling cancelFunction or cancelAllFunction. This diff introduces cancelFunctionAndWait and cancelAllFunctionsAndWait, making it possible to wait for completion of current running function.

Reviewed By: yfeldblum

Differential Revision: D4324384

fbshipit-source-id: ac4b272894f753ef3bb175173f10d1ca20c17c41
folly/experimental/FunctionScheduler.cpp
folly/experimental/FunctionScheduler.h
folly/experimental/test/FunctionSchedulerTest.cpp