isle/LEGO1/mxthread.h

58 lines
906 B
C
Raw Normal View History

#ifndef MXTHREAD_H
#define MXTHREAD_H
2023-07-12 17:12:03 -04:00
#include "compat.h"
#include "mxsemaphore.h"
2023-10-24 19:38:27 -04:00
#include "mxtypes.h"
class MxCore;
// VTABLE 0x100dc860
2023-10-24 19:38:27 -04:00
class MxThread {
public:
2023-10-24 19:38:27 -04:00
// Note: Comes before virtual destructor
virtual MxResult Run();
2023-10-24 19:38:27 -04:00
MxResult Start(int p_stack, int p_flag);
2023-10-24 19:38:27 -04:00
void Terminate();
2023-10-24 19:38:27 -04:00
void Sleep(MxS32 p_milliseconds);
2023-10-24 19:38:27 -04:00
// Inferred, not in DLL
inline MxBool IsRunning() { return m_running; }
protected:
2023-10-24 19:38:27 -04:00
MxThread();
public:
2023-10-24 19:38:27 -04:00
virtual ~MxThread();
private:
2023-10-24 19:38:27 -04:00
static unsigned ThreadProc(void* p_thread);
2023-10-24 19:38:27 -04:00
MxULong m_hThread;
MxU32 m_threadId;
MxBool m_running;
MxSemaphore m_semaphore;
protected:
MxCore* m_target;
};
// VTABLE 0x100dc6d8
2023-10-24 19:38:27 -04:00
class MxTickleThread : public MxThread {
public:
2023-10-24 19:38:27 -04:00
MxTickleThread(MxCore* p_target, int p_frequencyMS);
2023-10-24 19:38:27 -04:00
// Only inlined, no offset
virtual ~MxTickleThread() {}
2023-10-24 19:38:27 -04:00
MxResult Run() override;
private:
2023-10-24 19:38:27 -04:00
MxS32 m_frequencyMS;
};
2023-07-12 17:12:03 -04:00
#endif // MXTHREAD_H