EventBase keepAlive counter is not atomic
authorJoseph Griego <jgriego@fb.com>
Tue, 14 Jun 2016 00:49:38 +0000 (17:49 -0700)
committerFacebook Github Bot 9 <facebook-github-bot-9-bot@fb.com>
Tue, 14 Jun 2016 00:53:28 +0000 (17:53 -0700)
commitcafe469ac72ad3177dea2a7b130499f444a91233
tree59200a8690b5e614eb1cb63f4439f820432b3fef
parentf04cf0cd86456b9a11bc545a231fff56693a6124
EventBase keepAlive counter is not atomic

Summary: Since loopKeepAlive() is always used from the EventBase thread, there's no need for the overhead of an shared_ptr (and therefore, an atomic ref counter); we can get away without thread safety. This also allows us to discard the (sometimes incorrect) optimization of not returning a handle when it appears the loop will continue running anyways

Reviewed By: andriigrynenko

Differential Revision: D3375503

fbshipit-source-id: 474e4fcf992bdc4fcca9370d3c57bdcc4e042386
folly/io/async/EventBase.cpp
folly/io/async/EventBase.h
folly/io/async/test/EventBaseTest.cpp