CTR-Pia  5.4.3
Game Communication Engine
 全て クラス ネームスペース 関数 変数 型定義 列挙型 列挙型の値 ページ
common_ScopedLock.h
1 /*--------------------------------------------------------------------------------*
2  Copyright (C)Nintendo All rights reserved.
3 
4  These coded instructions, statements, and computer programs contain proprietary
5  information of Nintendo and/or its licensed developers and are protected by
6  national and international copyright laws. They may not be disclosed to third
7  parties or copied or duplicated in any form, in whole or in part, without the
8  prior written consent of Nintendo.
9 
10  The content herein is highly confidential and should be handled accordingly.
11  *--------------------------------------------------------------------------------*/
12 
13 
14 #pragma once
15 
16 #include <nn/pia/common/common_Definitions.h>
17 
18 
19 namespace nn
20 {
21 namespace pia
22 {
23 namespace common
24 {
25 
26 /*!
27 @cond PRIVATE
28  @brief このインスタンスの寿命の間ロックします。
29  */
30 template <typename T>
31 class ScopedLock : public common::RootObject
32 {
33 public:
34  explicit ScopedLock(T* pTarget)
35  : m_pTarget(pTarget)
36  {
37  m_pTarget->Lock();
38  }
39 
40  ~ScopedLock()
41  {
42  m_pTarget->Unlock();
43  }
44 
45 private:
46  T* m_pTarget;
47 };
48 //! @endcond
49 }
50 }
51 } // end of namespace nn::pia::common