Skip to content

Commit

Permalink
Use EventBase::runInEventBaseThreadAlwaysEnqueue instead of spawning …
Browse files Browse the repository at this point in the history
…a thread

Summary: Use EventBase::runInEventBaseThreadAlwaysEnqueue instead of spawning a thread

Reviewed By: andreazevedo

Differential Revision: D13392036

fbshipit-source-id: ca40c15bea237c8279841793e7861909a1f7f1a5
  • Loading branch information
dmm-fb authored and facebook-github-bot committed Dec 8, 2018
1 parent a7156e3 commit 4d98639
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions mcrouter/lib/network/AsyncMcServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,8 @@ class ShutdownPipe : public folly::EventHandler {
int fd_;

void handlerReady(uint16_t /* events */) noexcept final {
std::thread t([&] {
evb_.runInEventBaseThread([&, s = &server_] { s->shutdown(); });
});
t.join();
evb_.runInEventBaseThreadAlwaysEnqueue(
[&, s = &server_] { s->shutdown(); });
}
};

Expand Down

0 comments on commit 4d98639

Please sign in to comment.