kodi
IThreadImpl.h
1 /*
2  * Copyright (C) 2005-2022 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "threads/Thread.h"
12 
13 #include <memory>
14 #include <string>
15 #include <thread>
16 
18 {
19 public:
20  virtual ~IThreadImpl() = default;
21 
22  static std::unique_ptr<IThreadImpl> CreateThreadImpl(std::thread::native_handle_type handle);
23 
28  virtual void SetThreadInfo(const std::string& name) = 0;
29 
34  virtual bool SetPriority(const ThreadPriority& priority) = 0;
35 
36 protected:
37  IThreadImpl(std::thread::native_handle_type handle) : m_handle(handle) {}
38 
39  std::thread::native_handle_type m_handle;
40 
41 private:
42  IThreadImpl() = delete;
43 };
virtual bool SetPriority(const ThreadPriority &priority)=0
Set the thread priority via the native threading library.
Definition: IThreadImpl.h:17
virtual void SetThreadInfo(const std::string &name)=0
Set the thread name and other info (platform dependent)