Initial re-upload of spice2x-24-08-24
This commit is contained in:
45
external/stepmaniax-sdk/sdk/Windows/SMXThread.h
vendored
Normal file
45
external/stepmaniax-sdk/sdk/Windows/SMXThread.h
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
#ifndef SMXThread_h
|
||||
#define SMXThread_h
|
||||
|
||||
// A base class for a thread.
|
||||
#include "Helpers.h"
|
||||
#include <string>
|
||||
|
||||
namespace SMX
|
||||
{
|
||||
|
||||
class SMXThread
|
||||
{
|
||||
public:
|
||||
SMXThread(SMX::Mutex &lock);
|
||||
|
||||
// Raise the priority of the thread.
|
||||
void SetHighPriority(bool bHighPriority);
|
||||
|
||||
// Start the thread, giving it a name for debugging.
|
||||
void Start(std::string name);
|
||||
|
||||
// Shut down the thread. This function won't return until the thread
|
||||
// has been stopped.
|
||||
void Shutdown();
|
||||
|
||||
// Return true if this is the calling thread.
|
||||
bool IsCurrentThread() const;
|
||||
|
||||
// The derived class implements this.
|
||||
virtual void ThreadMain() = 0;
|
||||
|
||||
protected:
|
||||
static DWORD WINAPI ThreadMainStart(void *self);
|
||||
|
||||
SMX::Mutex &m_Lock;
|
||||
SMX::Event m_Event;
|
||||
bool m_bShutdown = false;
|
||||
|
||||
private:
|
||||
HANDLE m_hThread = INVALID_HANDLE_VALUE;
|
||||
DWORD m_iThreadId = 0;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user