OpenZWave Library  1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Mutex.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 //
3 // Mutex.h
4 //
5 // Cross-platform mutex
6 //
7 // Copyright (c) 2010 Mal Lansell <mal@lansell.org>
8 // All rights reserved.
9 //
10 // SOFTWARE NOTICE AND LICENSE
11 //
12 // This file is part of OpenZWave.
13 //
14 // OpenZWave is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU Lesser General Public License as published
16 // by the Free Software Foundation, either version 3 of the License,
17 // or (at your option) any later version.
18 //
19 // OpenZWave is distributed in the hope that it will be useful,
20 // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 // GNU Lesser General Public License for more details.
23 //
24 // You should have received a copy of the GNU Lesser General Public License
25 // along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
26 //
27 //-----------------------------------------------------------------------------
28 #ifndef _Mutex_H
29 #define _Mutex_H
30 
31 #include "platform/Wait.h"
32 
33 namespace OpenZWave
34 {
35  class MutexImpl;
36 
39  class Mutex: public Wait
40  {
41  public:
46  Mutex();
47 
57  bool Lock( bool const _bWait = true );
58 
64  void Unlock();
65 
69  virtual bool IsSignalled();
70  protected:
71 
76  ~Mutex();
77 
78  private:
79  Mutex( Mutex const& ); // prevent copy
80  Mutex& operator = ( Mutex const& ); // prevent assignment
81 
82  MutexImpl* m_pImpl; // Pointer to an object that encapsulates the platform-specific implementation of a mutex.
83  };
84 
85 } // namespace OpenZWave
86 
87 #endif //_Mutex_H
88 
~Mutex()
Definition: Mutex.cpp:58
void Unlock()
Definition: Mutex.cpp:81
bool Lock(bool const _bWait=true)
Definition: Mutex.cpp:69
Platform-independent definition of Wait objects.
Definition: Wait.h:41
Implements a platform-independent mutex–for serializing access to a shared resource.
Definition: Mutex.h:39
virtual bool IsSignalled()
Definition: Mutex.cpp:98
Mutex()
Definition: Mutex.cpp:47
Windows-specific implementation of the Mutex class.
Definition: windows/MutexImpl.h:38