1 /*---------------------------------------------------------------------------*
2   Project:  NintendoWare
3   File:     os_Mutex.h
4 
5   Copyright (C)2009-2011 Nintendo/HAL Laboratory, Inc.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain proprietary
8   information of Nintendo and/or its licensed developers and are protected by
9   national and international copyright laws. They may not be disclosed to third
10   parties or copied or duplicated in any form, in whole or in part, without the
11   prior written consent of Nintendo.
12 
13   The content herein is highly confidential and should be handled accordingly.
14 
15   $Revision: 31311 $
16  *---------------------------------------------------------------------------*/
17 
18 #ifndef NW_OS_MUTEX_H_
19 #define NW_OS_MUTEX_H_
20 
21 #include <nw/types.h>
22 #include <nw/config/macros.h>
23 
24 #include NW_ADAPTIVE_HEADER(nw/os/platform/os_Mutex, NW_PLATFORM_NAME.h)
25 
26 namespace nw {
27 namespace os {
28 
29 //---------------------------------------------------------------------------
30 //! @brief        排他をおこなうロックオブジェクトです。
31 //---------------------------------------------------------------------------
32 typedef nw::os::internal::LockObject LockObject;
33 
34 //---------------------------------------------------------------------------
35 //! @brief        空のロックオブジェクトです。
36 //---------------------------------------------------------------------------
37 class NullLockObject
38 {
39 public:
40     //---------------------------------------------------------------------------
41     //! @brief        ロックをおこないます。
42     //---------------------------------------------------------------------------
Lock()43     void Lock() {}
44 
45     //---------------------------------------------------------------------------
46     //! @brief        ロックの取得を試みて、失敗した場合は false を返します。
47     //!
48     //! @return       ロックに成功した場合は true、失敗した場合は false を返します。
49     //---------------------------------------------------------------------------
TryLock()50     bool TryLock() { return true; }
51 
52     //---------------------------------------------------------------------------
53     //! @brief        ロックを解除します。
54     //---------------------------------------------------------------------------
Unlock()55     void Unlock()  {}
56 };
57 
58 } // namespace os
59 } // namespace nw
60 
61 #endif /* NW_OS_MUTEX_H_ */
62 
63