1 //----------------------------------------------------------------------------- 2 // 3 // MutexImpl.h 4 // 5 // WinRT implementation of the cross-platform mutex 6 // 7 // Copyright (c) 2015 Microsoft Corporation 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 _MutexImpl_H 29 #define _MutexImpl_H 30 31 #include <windows.h> 32 33 34 namespace OpenZWave 35 { 36 /** \brief Windows-specific implementation of the Mutex class. 37 */ 38 class MutexImpl 39 { 40 private: 41 friend class Mutex; 42 43 MutexImpl(); 44 ~MutexImpl(); 45 46 bool Lock( bool const _bWait = true ); 47 void Unlock(); 48 49 bool IsSignalled(); 50 51 CRITICAL_SECTION m_criticalSection; 52 uint32 m_lockCount; // Keep track of the locks (there can be more than one if they occur on the same thread. 53 }; 54 55 } // namespace OpenZWave 56 57 #endif //_MutexIF_H 58 59