/*---------------------------------------------------------------------------* Project: NintendoWare File: snd_TaskThread.h Copyright (C)2009-2010 Nintendo Co., Ltd./HAL Laboratory, Inc. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. $Revision: 29726 $ *---------------------------------------------------------------------------*/ #ifndef NW_SND_TASK_THREAD_H_ #define NW_SND_TASK_THREAD_H_ #include namespace nw { namespace snd { namespace internal { class TaskThread { public: TaskThread(); ~TaskThread(); bool Create( s32 priority, ThreadStack& stack ); void Destroy(); bool IsCreated() const { return m_IsCreated != 0; } void SetPriority( s32 priority ) { m_Thread.ChangePriority( priority ); } bool TryLock() { return m_CriticalSection.TryEnter(); } void Lock() { m_CriticalSection.Enter(); } void Unlock() { m_CriticalSection.Leave(); } private: void ThreadProc(); static void ThreadFunc( uptr arg ); nn::os::Thread m_Thread; mutable nn::os::CriticalSection m_CriticalSection; volatile bool m_IsFinished; bool m_IsCreated; }; } // namespace nw::snd::internal } // namespace nw::snd } // namespace nw #endif /* NW_SND_TASK_THREAD_H_ */