Alphabetical Class Index  Class Hierarchy   File Members   Compound Members   File List  

HMutexOOC.h
00001 // Copyright (c) 1998-2014 by Tech Soft 3D, Inc.
00002 //
00003 // The information contained herein is confidential and proprietary to Tech Soft 3D, Inc.,
00004 // and considered a trade secret as defined under civil and criminal statutes.
00005 // Tech Soft 3D, Inc. shall pursue its civil and criminal remedies in the event of
00006 // unauthorized use or misappropriation of its trade secrets.  Use of this information
00007 // by anyone other than authorized employees of Tech Soft 3D, Inc. is granted only under
00008 // a written non-disclosure agreement, expressly prescribing the scope and manner of such use.
00009 
00010 #pragma once
00011 
00012 
00013 #ifdef H_PACK_8
00014 #   pragma pack(push)
00015 #   pragma pack(8)
00016 #endif
00017 
00018 
00020 
00021 
00024 class HMutexOOC {
00025 public:
00028     class LockGuard {
00029     public:
00033         LockGuard (HMutexOOC & mutex)
00034             : mutex(mutex)
00035         {
00036             mutex.Lock();
00037         }
00038 
00041         ~LockGuard ()
00042         {
00043             mutex.Unlock();
00044         }
00045 
00046     private:
00047         LockGuard (LockGuard &&); // disable
00048         LockGuard (LockGuard const &); // disable
00049         void operator= (LockGuard &&); // disable
00050         void operator= (LockGuard const &); // disable
00051 
00052     private:
00053         HMutexOOC & mutex;
00054     };
00055 
00056 public:
00059     HMutexOOC ();
00060 
00061     ~HMutexOOC ();
00062 
00065     void Lock ();
00066 
00069     void Unlock ();
00070 
00071 private:
00072     void * opaque_mutex;
00073 };
00074 
00075 
00076 
00077 
00078 
00079 
00080 
00081