![]() |
VR-Link API Documentation for HLA 1.3
|
00001 /****************************************************************************** 00002 ** Copyright (c) 1992-2010 VT MAK 00003 ** All rights reserved. 00004 ******************************************************************************/ 00008 #pragma once 00009 00010 #include "vlMachineTypes.h" 00011 00012 #ifdef DtUSE_UTILITIES_NAMESPACE 00013 namespace DtUSE_UTILITIES_NAMESPACE 00014 { 00015 #endif 00016 00017 00018 00019 class DtMutex; 00020 00037 class DT_DLL_VLUTIL DtScopedLock 00038 { 00039 public: 00041 explicit DtScopedLock(DtMutex& mx, bool initially_locked=true); 00042 00044 ~DtScopedLock(); 00045 00047 void lock(); 00048 00050 void unlock(); 00051 00052 //Get the locked state of the mutex. 00056 bool locked() const; 00057 00058 //Get the address of the scoped lock if the mutex is locked, 00060 operator const void*() const; 00061 00062 private: 00064 DtScopedLock(const DtScopedLock&); 00065 DtScopedLock& operator=(const DtScopedLock&); 00066 00067 protected: 00068 DtMutex& myMutex; 00069 bool myLockedState; 00070 }; 00071 00072 #ifdef DtUSE_UTILITIES_NAMESPACE 00073 } 00074 #endif 00075