1
0
mirror of https://github.com/Halofreak1990/XFXFramework synced 2024-12-26 13:49:34 +01:00
Halofreak1990 8f089dc2ab Added the current XFX directory tree.
WARNING!!! This revision cannot compile correctly. It is updated to reflect the many changes within the XFX project.
2010-12-04 16:14:34 +00:00

62 lines
1.6 KiB
C++

/********************************************************
* Thread.h *
* *
* XFX Thread definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef THREAD_H
#define THREAD_H
#ifdef ENABLE_XBOX
extern "C" {
#include <xboxkrnl/xboxkrnl.h>
}
#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