CyberEngineMkIII
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
CYBThread.hpp
Go to the documentation of this file.
1 #pragma once
3 namespace CYB {
4  namespace Platform {
5  namespace System {
7  class Thread : private Implementation::Thread {
8  friend class Implementation::Thread; //Allow it to call back into RunThread
9  public:
11  enum class State {
12  IDLE,
13  RUNNING,
14  FINISHED,
15  };
16  private:
18  private:
25  static void RunThread(API::Threadable& AThreadable) noexcept;
26  public:
33  static void Sleep(const unsigned int AMilliseconds) noexcept;
39  static void Yield(void) noexcept;
47  Thread(API::Threadable& AThreadable);
49  Thread(const Thread&) = delete;
51  ~Thread();
52 
59  void Cancel(void);
66  bool IsFinished(void) const noexcept;
72  void Wait(void) const noexcept;
73  };
74  };
75  };
76 };
The thread has finished running.
The thread is not running and can be started.
bool FCancelSubmitted
A check to make sure FThreadable.CancelThreadedOperation is not called more than once.
Definition: CYBThread.hpp:17
Contains the thread handle and startup function.
Definition of a platform thread object.
Definition: CYBThread.hpp:7
State
The states of a thread.
Definition: CYBThread.hpp:11
static void RunThread(API::Threadable &AThreadable) noexcept
Properly traps and logs exceptions generated by threads. And runs AThreadable.
Definition: CYBThread.cpp:4
bool IsFinished(void) const noexcept
Check whether or not the owned thread is terminated.
The basic multithreading interface.
Definition: Threadable.hpp:6
void Cancel(void)
Cancel a thread. Calls CancelThreadedOperation on the assigned Threadable in the current thread if Is...
Definition: CYBThread.cpp:35
static void Sleep(const unsigned int AMilliseconds) noexcept
Put the thread to sleep for at least AMilliseconds.
void Wait(void) const noexcept
Blocks current thread until the owned thread has terminated.
static void Yield(void) noexcept
Expires the current threads processor time and sumbits it to the OS for rescheduling.