1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     util_ScopedLockImpl.h
4 
5   Copyright (C)2009 Nintendo Co., Ltd.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law.  They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Rev: 12449 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NN_UTIL_DETAIL_UTIL_SCOPEDLOCK_H_
17 #define NN_UTIL_DETAIL_UTIL_SCOPEDLOCK_H_
18 
19 #ifdef __cplusplus
20 
21 #define NN_UTIL_DETAIL_DEFINE_SCOPED_LOCK(typeName, lockCall, unlockCall) \
22     class typeName::ScopedLock \
23     { \
24     private: \
25         typeName& m_Reference; \
26     public: \
27         ScopedLock(typeName& reference) : m_Reference(reference) { m_Reference.lockCall; } \
28         ~ScopedLock() { m_Reference.unlockCall; } \
29     }
30 
31 #endif // __cplusplus
32 
33 #endif
34