/* -----------------------------------------------------------------------------
	GSFramework
	Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
----------------------------------------------------------------------------- */


#ifndef __NTHREAD__
#define __NTHREAD__


		#include "thread/atomic_value.h"


namespace GS {
	namespace Threading {

/*
	@short	Thread abstraction class.
	@author	Emmanuel Julien (ejulien@gsworks.fr)
*/
struct	Thread
{
		void		*handle;

virtual	bool		Start();

		void		Kill();
		void		Join();

static	void		SetName(const char *);
		// Yield execution to the next running system thread.
static	void		Switch();

		/*
			@short	Set thread priority.

			Set the thread priority from 0 to 31.
			0 is the highest priority, 31 is the lowest.

			@return	False is the required priority was invalid.
		*/
		bool		SetPriority(int priority = 16);

		/// Main thread execution function.
virtual	void		Execute() = 0;

		Thread();
virtual	~Thread();
};

	}	// Threading
}	// GS


#endif	// __NTHREAD__
