SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MFXMutex.h
Go to the documentation of this file.
1 /****************************************************************************/
9 //
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
12 // Copyright (C) 2007-2014 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 
23 
24 #ifndef MFXMUTEX_H
25 #define MFXMUTEX_H
26 
27 
28 // ===========================================================================
29 // included modules
30 // ===========================================================================
31 #ifdef _MSC_VER
32 #include <windows_config.h>
33 #else
34 #include <config.h>
35 #endif
36 
37 #include <fx.h>
39 
40 #ifndef WIN32
41 typedef void* FXThreadMutex; // handle to a mutex
42 #else
43 #define NOMINMAX
44 #include <windows.h>
45 #undef NOMINMAX
46 typedef HANDLE FXThreadMutex; // handle to a mutex
47 #endif
48 
49 
50 
51 
56 class MFXMutex : public AbstractMutex {
57 public:
59  MFXMutex();
60 
62  void lock();
63 
65  void unlock();
66 
68  virtual ~MFXMutex();
69 
70  inline FXbool locked() {
71  return lock_ ? TRUE : FALSE;
72  }
73 
74 protected:
75  FXuint lock_; // lock count
76 
77 private:
79 
80 private:
81  // dummy copy constructor and operator= to prevent copying
82  MFXMutex(const MFXMutex&);
83  MFXMutex& operator=(const MFXMutex&);
84 
85 };
86 
87 #endif // FXMUTEX_H
FXuint lock_
Definition: MFXMutex.h:75
MFXMutex & operator=(const MFXMutex &)
An abstract class for encapsulating mutex implementations.
Definition: AbstractMutex.h:49
FXThreadMutex mutexHandle
Definition: MFXMutex.h:78
void * FXThreadMutex
Definition: MFXMutex.h:41
virtual ~MFXMutex()
dtor
Definition: MFXMutex.cpp:72
void unlock()
release mutex lock
Definition: MFXMutex.cpp:96
void lock()
lock mutex
Definition: MFXMutex.cpp:86
FXbool locked()
Definition: MFXMutex.h:70
MFXMutex()
create me a mutex :-)
Definition: MFXMutex.cpp:50