add cancelFunctionAndWait and cancelAllFunctionsAndWait to FunctionScheduler