FunctionScheduler - set running_ when it has actually started running
authorIgor Adamski <iadamski@fb.com>
Tue, 31 Jan 2017 10:15:36 +0000 (02:15 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Tue, 31 Jan 2017 10:17:55 +0000 (02:17 -0800)
commitb6916a3a978b078b6275eb756762320d180eb09f
tree9f73cdbe0f46d5cda7aca13889f6cb8c13008ec2
parent84d872be72aa1909dfad98b0f7644d2c157c47a9
FunctionScheduler - set running_ when it has actually started running

Summary:
When start() throws because of reasons (in my case it was std::system_error("Resource temporarily unavailalble") coming from std::thread constructo)
and during the exception propagation we will have to destroy FunctionScheduler then
thread_.join() in shutdown will throw again.
This diff sets running_ after the thread is created.

Reviewed By: yfeldblum

Differential Revision: D4469816

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