Use Baton (again) in EventBase::runInEventBaseThreadAndWait
[folly.git] / folly / io / async / EventBaseThread.cpp
index 5adfe52a153858e06cf39ac917b7f3cb9afc8064..fb529eed9195115d886d122caf39a79d5b8a6de0 100644 (file)
@@ -23,10 +23,13 @@ namespace folly {
 
 EventBaseThread::EventBaseThread() : EventBaseThread(true) {}
 
-EventBaseThread::EventBaseThread(bool autostart, EventBaseManager* ebm)
+EventBaseThread::EventBaseThread(
+    bool autostart,
+    EventBaseManager* ebm,
+    folly::StringPiece threadName)
     : ebm_(ebm) {
   if (autostart) {
-    start();
+    start(threadName);
   }
 }
 
@@ -47,11 +50,11 @@ bool EventBaseThread::running() const {
   return !!th_;
 }
 
-void EventBaseThread::start() {
+void EventBaseThread::start(folly::StringPiece threadName) {
   if (th_) {
     return;
   }
-  th_ = make_unique<ScopedEventBaseThread>(ebm_);
+  th_ = std::make_unique<ScopedEventBaseThread>(ebm_, threadName);
 }
 
 void EventBaseThread::stop() {