#pragma once
#ifndef SYSTHREAD_H_
#define SYSTHREAD_H_

#include "GlobalDefs.h"
#include "windows.h"

class SysThread
{
public:
   enum Priority
   {
      PRI_LOWEST,
      PRI_STATUS,
      PRI_MEDIUM,
      PRI_STORAGE,
      PRI_PROCESS,
      PRI_ACQUIRE,
      PRI_HIGHEST
   };

   //THREAD_PRIORITY_IDLE,          
   //THREAD_PRIORITY_LOWEST,        
   //THREAD_PRIORITY_BELOW_NORMAL,  
   //THREAD_PRIORITY_NORMAL,        
   //THREAD_PRIORITY_ABOVE_NORMAL,  
   //THREAD_PRIORITY_HIGHEST,       
   //THREAD_PRIORITY_TIME_CRITICAL, 

   SysThread( const char* name, Priority priority, UINT32 stacksize = 0x10000 );
   ~SysThread(void);

   void Start(void (*function)(void*), void* argument);
	void Stop() { TerminateThread( m_Handle, 0 ); }
   void SetPriority(Priority priority);   // post - Start()

private:
   static unsigned long Startfunc( SysThread *pSysThread );

   void		*m_Handle;
	char		m_strName[32];
   Priority m_Priority;
   UINT32	m_u32Stacksize;
	void		(*m_pFunction)(void*);
   void		*m_pArgument;
};

#endif
