Reduce Code Duplication In NotificationQueue With Universal Reference
[folly.git] / folly / io / async / EventBaseThread.cpp
index ebe9ac504f1ab79c3ceca8bcdb76fdaa87f3a7f6..fb529eed9195115d886d122caf39a79d5b8a6de0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -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() {