/****************************************************************************************************

		BasicThreads.h
		Copyright: (c) 2001 Eovia Corp. All rights reserved.

		Author:	Arnaud
		Date:	10/16/2003

****************************************************************************************************/

#ifndef __BasicThreads__
#define __BasicThreads__

#if CP_PRAGMA_ONCE
#pragma once
#endif


#include "IShThreadUtilities.h"
#include "MCCountedObject.h"
#include "MCCountedPtrHelper.h"

/// \addtogroup BaseClass
/// \{


/// Basic thread class.  Derive from this so you only need to implement Work()
class TBasicThread : public IExThread, public TMCCountedObject
{
protected:
	TBasicThread	() {}
	~TBasicThread	() {}
public:
	virtual MCCOMErr MCCOMAPI QueryInterface	(const MCIID& riid, void** ppvObj)
	{
		if (MCIsEqualIID(riid, IID_IExThread))
		{
			TMCCountedGetHelper<IExThread> result(ppvObj);
			result = this;
			return MC_S_OK;
		}
		return TMCCountedObject::QueryInterface(riid, ppvObj);
	}

	virtual uint32 	 MCCOMAPI AddRef			()		{ return TMCCountedObject::AddRef(); }
	virtual uint32 	 MCCOMAPI Release			()		{ return TMCCountedObject::Release(); }
};



/// \}




#endif
