Add keepAlive() mechanism
authorAndrii Grynenko <andrii@fb.com>
Thu, 9 Feb 2017 18:58:07 +0000 (10:58 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Thu, 9 Feb 2017 19:04:51 +0000 (11:04 -0800)
commit53367378d6e5455dfbc649b325cfa583c54227ac
tree4812fe3d149c2dd74a752e0f6eef514479267d69
parentcfe87b2eff76de4f75c03f12952d4521c5918c43
Add keepAlive() mechanism

Summary:
EventBase and VirtualEventBase already had a loopKeepAlive() mechanism, which enabled libraries to prevent EventBase/VirtualEventBase from being destroyed until all keep-alive tokens were released.

This change adds generic keepAlive() support into folly::Executor. folly::Executors which don't support keep-alive mechanism yet, will just return a no-op KeepAlive token.

Reviewed By: yfeldblum

Differential Revision: D4516649

fbshipit-source-id: 869779621c746cb14d985aa73bc4536859914c03
folly/Executor.cpp
folly/Executor.h
folly/fibers/EventBaseLoopController-inl.h
folly/fibers/EventBaseLoopController.h
folly/io/async/EventBase.h
folly/io/async/VirtualEventBase.cpp
folly/io/async/VirtualEventBase.h
folly/io/async/test/EventBaseTest.cpp