/******************************************************** * Thread.h * * * * XFX Thread definition file * * Copyright © XFX Team. All Rights Reserved * ********************************************************/ #ifndef THREAD_H #define THREAD_H #ifdef ENABLE_XBOX extern "C" { #include } #endif #include "ThreadState.h" #include "TimeSpan.h" namespace System { namespace Threading { class Thread { int lock_thread_id; HANDLE system_thread_handle; PKSTART_ROUTINE callback; int stack_size; static ULONG Id; PULONG suspendCount; ThreadState state; private: void Thread_init(); public: //Creates a new instance of the Thread class with the specified callback function, but doesn't start yet. Thread(PKSTART_ROUTINE callBack); //Creates a new instance of the Thread class with the specified callback function and stack size, but doesn't start yet. Thread(PKSTART_ROUTINE callBack, int stackSize); void Abort(); void Interrupt(); //Returns a value indicating whether the thread is running int IsAlive(); //Resumes a previously suspended thread. void Resume(); //Set the thread priority, valid values are 0 (Low), 16 (Low_RealTime), 31 (High), 32 (Maximum) void SetPriority(int priority); static void Sleep(int millisecondsTimeout); static void Sleep(TimeSpan timeout); //Start executing the thread. void Start(); //Suspend the thread execution, call Thread::Resume() to resume the thread. void Suspend(); }; } } #endif //THREAD_H