SUMO - Simulation of Urban MObility
MFXMutex.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2007-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
19 //
20 /****************************************************************************/
21 
22 
23 #ifndef MFXMUTEX_H
24 #define MFXMUTEX_H
25 
26 
27 // ===========================================================================
28 // included modules
29 // ===========================================================================
30 #ifdef _MSC_VER
31 #include <windows_config.h>
32 #else
33 #include <config.h>
34 #endif
35 
36 #include <fx.h>
38 
39 #ifndef WIN32
40 typedef void* FXThreadMutex; // handle to a mutex
41 #else
42 #define NOMINMAX
43 #include <windows.h>
44 #undef NOMINMAX
45 typedef HANDLE FXThreadMutex; // handle to a mutex
46 #endif
47 
48 
49 
50 
55 class MFXMutex : public AbstractMutex {
56 public:
58  MFXMutex();
59 
61  void lock();
62 
64  void unlock();
65 
67  virtual ~MFXMutex();
68 
69  inline FXbool locked() {
70  return lock_ ? TRUE : FALSE;
71  }
72 
73 protected:
74  FXuint lock_; // lock count
75 
76 private:
78 
79 private:
80  // dummy copy constructor and operator= to prevent copying
81  MFXMutex(const MFXMutex&);
82  MFXMutex& operator=(const MFXMutex&);
83 
84 };
85 
86 #endif // FXMUTEX_H
FXuint lock_
Definition: MFXMutex.h:74
MFXMutex & operator=(const MFXMutex &)
An abstract class for encapsulating mutex implementations.
Definition: AbstractMutex.h:48
FXThreadMutex mutexHandle
Definition: MFXMutex.h:77
void * FXThreadMutex
Definition: MFXMutex.h:40
virtual ~MFXMutex()
dtor
Definition: MFXMutex.cpp:69
void unlock()
release mutex lock
Definition: MFXMutex.cpp:93
void lock()
lock mutex
Definition: MFXMutex.cpp:83
FXbool locked()
Definition: MFXMutex.h:69
MFXMutex()
create me a mutex :-)
Definition: MFXMutex.cpp:47