From 4d98639000d2e36217a901af00e8e2f3f9c1bf24 Mon Sep 17 00:00:00 2001 From: Dan Melnic Date: Sat, 8 Dec 2018 15:02:07 -0800 Subject: [PATCH] Use EventBase::runInEventBaseThreadAlwaysEnqueue instead of spawning a thread Summary: Use EventBase::runInEventBaseThreadAlwaysEnqueue instead of spawning a thread Reviewed By: andreazevedo Differential Revision: D13392036 fbshipit-source-id: ca40c15bea237c8279841793e7861909a1f7f1a5 --- mcrouter/lib/network/AsyncMcServer.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mcrouter/lib/network/AsyncMcServer.cpp b/mcrouter/lib/network/AsyncMcServer.cpp index 47f09468e..077a8f32c 100644 --- a/mcrouter/lib/network/AsyncMcServer.cpp +++ b/mcrouter/lib/network/AsyncMcServer.cpp @@ -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(); }); } };