1 // Copyright 2018 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef BASE_TASK_THREAD_POOL_SERVICE_THREAD_H_ 6 #define BASE_TASK_THREAD_POOL_SERVICE_THREAD_H_ 7 8 #include "base/base_export.h" 9 #include "base/threading/thread.h" 10 11 namespace base { 12 namespace internal { 13 14 // The ThreadPool's ServiceThread is a mostly idle thread that is responsible 15 // for handling async events (e.g. delayed tasks and async I/O). Its role is to 16 // merely forward such events to their destination (hence staying mostly idle 17 // and highly responsive). 18 // It aliases Thread::Run() to enforce that ServiceThread::Run() be on the stack 19 // and make it easier to identify the service thread in stack traces. 20 class BASE_EXPORT ServiceThread : public Thread { 21 public: 22 ServiceThread(); 23 24 ServiceThread(const ServiceThread&) = delete; 25 ServiceThread& operator=(const ServiceThread&) = delete; 26 ~ServiceThread() override = default; 27 28 private: 29 // Thread: 30 void Run(RunLoop* run_loop) override; 31 }; 32 33 } // namespace internal 34 } // namespace base 35 36 #endif // BASE_TASK_THREAD_POOL_SERVICE_THREAD_H_ 37