summaryrefslogtreecommitdiffstats
path: root/xbmc/threads/IThreadImpl.h
blob: f631c7995d7b5b81c7d457aaabcf15e413a57ce6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
 *  Copyright (C) 2005-2022 Team Kodi
 *  This file is part of Kodi - https://kodi.tv
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 *  See LICENSES/README.md for more information.
 */

#pragma once

#include "threads/Thread.h"

#include <memory>
#include <string>
#include <thread>

class IThreadImpl
{
public:
  virtual ~IThreadImpl() = default;

  static std::unique_ptr<IThreadImpl> CreateThreadImpl(std::thread::native_handle_type handle);

  /*!
   * \brief Set the thread name and other info (platform dependent)
   *
   */
  virtual void SetThreadInfo(const std::string& name) = 0;

  /*!
   * \brief Set the thread priority via the native threading library
   *
   */
  virtual bool SetPriority(const ThreadPriority& priority) = 0;

protected:
  IThreadImpl(std::thread::native_handle_type handle) : m_handle(handle) {}

  std::thread::native_handle_type m_handle;

private:
  IThreadImpl() = delete;
};