Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkMutexLockHolder.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkMutexLockHolder.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-02-06 20:53:10 $
00007   Version:   $Revision: 1.3 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012   Portions of this code are covered under the VTK copyright.
00013   See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details.
00014 
00015      This software is distributed WITHOUT ANY WARRANTY; without even 
00016      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00017      PURPOSE.  See the above copyright notices for more information.
00018 
00019 =========================================================================*/
00020 #ifndef __itkMutexLockHolder_h
00021 #define __itkMutexLockHolder_h
00022 
00023 #include "itkMacro.h"
00024 
00025 namespace itk
00026 {
00027 
00031 template <class TMutex>
00032 class MutexLockHolder
00033 {
00034 public:
00035   typedef TMutex Mutex;
00036   MutexLockHolder(Mutex& mutex): m_Mutex(mutex)
00037     {
00038     m_Mutex.Lock();
00039     }
00040   ~MutexLockHolder()
00041     {
00042     m_Mutex.Unlock();
00043     }
00044 protected:
00045   Mutex& m_Mutex;
00046 };
00047 
00048 }//end itk namespace
00049 
00050 #endif
00051 

Generated at Sat Feb 28 13:04:31 2009 for ITK by doxygen 1.5.6 written by Dimitri van Heesch, © 1997-2000