Make global executors shutdown-safe
authorGiuseppe Ottaviano <ott@fb.com>
Mon, 18 Dec 2017 16:40:40 +0000 (08:40 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Mon, 18 Dec 2017 16:50:43 +0000 (08:50 -0800)
commitcfc602df8f8691d73fddea64f5bdc147a0f5c9b0
tree17504a169b8fa015cc318b02f4b4949010c1ad4d
parent3975849d4447642d6c476d430b8842bfd9b7b5b9
Make global executors shutdown-safe

Summary:
The `get*Executor()` APIs don't check whether the singletons
haven't been destroyed already. Add a check and allow to return
`nullptr` during shutdown.

Also do a general clean up of the code, there was no reason to use
three independent singletons (non-atomically destroyed) for each
executor.

Reviewed By: philippv, luciang

Differential Revision: D6589486

fbshipit-source-id: 20fb835db7e446bd811bbd6d5ddbc41db9e98b54
folly/executors/GlobalExecutor.cpp
folly/executors/GlobalExecutor.h