KWStyle - itkMutexLockHolder.h
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkMutexLockHolder.h.html,v $
5   Language:  C++
6   Date:      $Date: 2006/01/17 19:15:42 $
7   Version:   $Revision: 1.4 $
8
9   Copyright (c) Insight Software Consortium. All rights reserved.
10   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11
12   Portions of this code are covered under the VTK copyright.
13   See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details.
14
15      This software is distributed WITHOUT ANY WARRANTY; without even 
16      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
17 IND *****PURPOSE.  See the above copyright notices for more information.
18
19 =========================================================================*/
20 #ifndef __itkMutexLockHolder_h
21 #define __itkMutexLockHolder_h
22
23 #include "itkMacro.h"
24
25 namespace itk
26 {
27
28 /** \class MutexLockHolder
29  *
30  */
31 template <class TMutex>
32 class MutexLockHolder
33 {
34 public:
35   typedef TMutex Mutex;
36   MutexLockHolder(Mutex& mutex): m_Mutex(mutex)
37     {
38     m_Mutex.Lock();
39     }
40   ~MutexLockHolder()
41     {
42     m_Mutex.Unlock();
43     }
44 protected:
45   Mutex& m_Mutex;
46 };
47
48 }//end itk namespace
49
50 #endif
51
52 EOF

Generated by KWStyle 1.0b on Tuesday January,17 at 02:14:26PM
© Kitware Inc.