1
0
mirror of https://github.com/Halofreak1990/XFXFramework synced 2024-12-26 13:49:34 +01:00
Tom Lint 52ef14a94b Transition from SVN to Git
Added implicit conversion to base types to all primary types (UInt32 et
al)
Added implicit conversion from System::String to const char*
2013-05-05 18:18:41 +02:00

62 lines
1.6 KiB
C++

/********************************************************
* Thread.h *
* *
* XFX Thread definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _SYSTEM_THREADING_THREAD_
#define _SYSTEM_THREADING_THREAD_
extern "C"
{
#include <xboxkrnl/xboxkrnl.h>
}
#include "Enums.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_t 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);
~Thread();
void Abort();
void Interrupt();
//Returns a value indicating whether the thread is running
bool 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 //_SYSTEM_THREADING_THREAD_