#pragma once #include "ehs/Types.h" namespace ehs { class BaseThread { private: UInt_64 stackSize; protected: UInt_32 id; public: BaseThread(); BaseThread(UInt_64 stackSize); BaseThread(BaseThread&& thread) noexcept; BaseThread(const BaseThread& thread); BaseThread& operator=(BaseThread&& thread) noexcept; BaseThread& operator=(const BaseThread& thread); virtual void Detach(); virtual void Join() = 0; UInt_64 GetStackSize() const; UInt_32 GetId() const; static UInt_32 GetCurrentId(); virtual bool IsValid() const; /// A software implementation for sleeping the calling thread. /// @param [in] seconds The amount in seconds to sleep for. /// @returns The amount in seconds that the sleep exceeded for. /// @note A more precise sleep method but more taxing on the CPU. static float SoftSleep(float seconds); /// A hardware implementation for sleeping the calling thread. /// @param [in] milliseconds The amount in milliseconds to sleep for. /// @note A less precise sleep method but less taxing on the CPU. static void HardSleep(UInt_32 milliseconds); }; }