//////////////////////////////////////////////////////////////////////////////
//
// Asura_Platform_MultithreadTypes.h
//
// Copyright (c) 2006 Rebellion. All rights reserved.
//
// Description:
//
//     GC base classes to provide data for multithreading primitives
//
//////////////////////////////////////////////////////////////////////////////

// B E G I N   F I L E   W R A P P E R ///////////////////////////////////////

#ifdef ASURA_USE_PRAGMA_ONCE
    #pragma once
#endif

#ifndef ___ASURA_PLATFORM_MULTITHREADTYPES_H___
#define ___ASURA_PLATFORM_MULTITHREADTYPES_H___ 1

// Asura independent
#include "Debugging/Asura_Assert.h"

// Platform
#include <revolution/os.h>

typedef int Asura_ThreadID;

class Asura_Platform_MutexData
{
public:

	Asura_Platform_MutexData()
    {
		OSInitMutex(&m_xMutex);
    }

    ~Asura_Platform_MutexData()
    {
		// KOR 12/09/2006 - as far as I can tell, there's no mutex shutdown required on GameCube
    }

protected:

	OSMutex m_xMutex;
};


class Asura_Platform_SyncEvent
{
public:

	Asura_Platform_SyncEvent( const char* szName, bool bStartsSignalled )
	{
		OSInitCond(&m_xCondition);
		OSInitMutex(&m_xMutex);
		m_bSignalledOS = false;
	}

	~Asura_Platform_SyncEvent()
	{
		// KOR 12/09/2006 - as far as I can tell, there's no sync event shutdown required on GameCube
	}

protected:

	OSCond	m_xCondition;
	OSMutex m_xMutex;
	bool	m_bSignalledOS;
};


class Asura_Platform_Semaphore
{
public:

	Asura_Platform_Semaphore( const char* szName, u_int uInitialCount, u_int uMaxCount )
	{
		OSInitSemaphore(&m_xSemaphore, 0);
	}

	~Asura_Platform_Semaphore()
	{
	}

protected:
	OSSemaphore m_xSemaphore;
};


// E N D   F I L E   W R A P P E R ///////////////////////////////////////////

#endif // #ifndef ___ASURA_PLATFORM_MULTITHREADTYPES_H___
