Panda3D
mutexWin32Impl.h
1 // Filename: mutexWin32Impl.h
2 // Created by: drose (07Feb06)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef MUTEXWIN32IMPL_H
16 #define MUTEXWIN32IMPL_H
17 
18 #include "dtoolbase.h"
19 #include "selectThreadImpl.h"
20 
21 #ifdef WIN32_VC
22 #ifndef WIN32_LEAN_AND_MEAN
23 #define WIN32_LEAN_AND_MEAN 1
24 #endif
25 #include <windows.h>
26 
27 ////////////////////////////////////////////////////////////////////
28 // Class : MutexWin32Impl
29 // Description : Uses Windows native calls to implement a mutex.
30 ////////////////////////////////////////////////////////////////////
31 class EXPCL_DTOOL MutexWin32Impl {
32 public:
33  MutexWin32Impl();
34  INLINE ~MutexWin32Impl();
35 
36  INLINE void acquire();
37  INLINE bool try_acquire();
38  INLINE void release();
39 
40 private:
41  CRITICAL_SECTION _lock;
42  friend class ConditionVarWin32Impl;
43  friend class ConditionVarFullWin32Impl;
44 };
45 
46 #include "mutexWin32Impl.I"
47 
48 #endif // WIN32_VC
49 
50 #endif