Make outstanding LoopKeepAlive hold EventBase destructor
authorAndrii Grynenko <andrii@fb.com>
Fri, 20 May 2016 22:55:24 +0000 (15:55 -0700)
committerFacebook Github Bot 8 <facebook-github-bot-8-bot@fb.com>
Fri, 20 May 2016 23:08:24 +0000 (16:08 -0700)
commit0f76e090f18605286352ee92020efcb3556d4d69
treeae7ba049d838ce7cdac232fab271c73c498c100f
parentf464accb69e96176e5a313da5d24d76ee5297ca2
Make outstanding LoopKeepAlive hold EventBase destructor

Summary:
LoopKeepAlive handle can be grabbed to signal that some external event will later be scheduled on the EventBase via runInEventBaseThread. Usually the code which will be calling runInEventBaseThread only has a raw pointer to an EventBase, so it doesn't have any way to know it was destroyed.

This change ensures that EventBase destructor will keep running the event loop until all such LoopKeepAlive handles are released.

Reviewed By: yfeldblum

Differential Revision: D3323835

fbshipit-source-id: 4071dae691a61dfebe2f1759cf99f661b161fa4a
folly/io/async/EventBase.cpp
folly/io/async/test/EventBaseTest.cpp