diff options
| author | J M Rossy <[email protected]> | 2015-07-29 15:40:09 -0700 |
|---|---|---|
| committer | J M Rossy <[email protected]> | 2015-07-29 16:34:40 -0700 |
| commit | 5d61a4a79a1e96dc5d9af1e5e712c84507307544 (patch) | |
| tree | 49ed270893578cd18758b74ffcca16dc7ab948d6 /avscamera/sys/Mutex.cpp | |
| parent | 5d41613e26e147d2300c786bb2b34cb4b4067a25 (diff) | |
Samples update for public Windows 10 release
Fix #2 Enabling WPP Recorder in Sensors Samples causes errors
Fix #4 Add back fixed KMDOD sample
Add new BarcodeScanner sample in pos folder
Add new MagneticStripeReader sample in pos folder
Add new SynpaticsTouch sample in input folder
Add new Power Engine Plugin sample in pofx folder
Add new DeviceMft sample in avstream folder
Add new AvsCamera sample in root
Add new SimBatt sample in root
Add other pre-existing samples not yet released for Win10
Diffstat (limited to 'avscamera/sys/Mutex.cpp')
| -rw-r--r-- | avscamera/sys/Mutex.cpp | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/avscamera/sys/Mutex.cpp b/avscamera/sys/Mutex.cpp new file mode 100644 index 00000000..1dd3d88c --- /dev/null +++ b/avscamera/sys/Mutex.cpp @@ -0,0 +1,70 @@ +/************************************************************************** + + A/V Stream Camera Sample + + Copyright (c) 2013, Microsoft Corporation. + + File: + + Mutex.cpp + + Abstract: + + This file provides the implementation of KMutex and KScopedMutex. + + KMutex provides a wrapper around a KMUTEX object. KScopedMutex is + provided as a helper class to ensure all exits release the lock. + + History: + + created 7/16/2013 + +**************************************************************************/ + +#include "Common.h" + +// +// Dummy dtor. Required because the dtor is virtual. +// +KMutex::~KMutex() +{} + +// +// Preferred lock method. +// +_IRQL_requires_min_(PASSIVE_LEVEL) +_When_((Timeout==NULL || Timeout->QuadPart!=0), _IRQL_requires_max_(APC_LEVEL)) +_When_((Timeout!=NULL &&Timeout->QuadPart==0), _IRQL_requires_max_(DISPATCH_LEVEL)) +NTSTATUS +KMutex::Lock( + _In_opt_ PLARGE_INTEGER Timeout +) +{ + //DBG_ENTER(": Thread Owner = %p", m_Lock.OwnerThread); + + NTSTATUS status = + KeWaitForSingleObject( + &m_Lock, + Executive, + KernelMode, + FALSE, + Timeout ); + + //DBG_LEAVE(": Status = %d Thread Owner = %p", status, m_Lock.OwnerThread); + + return status; +} + +// +// Preferred unlock method. +// +_IRQL_requires_max_(DISPATCH_LEVEL) +void +KMutex::Unlock() +{ + //DBG_ENTER(": Thread Owner = %p", m_Lock.OwnerThread); + + KeReleaseMutex( &m_Lock, FALSE ); + + //DBG_LEAVE(": Thread Owner = %p", m_Lock.OwnerThread); +} |
