AAX SDK  2.4.1
Avid Audio Extensions Development Kit
AAX_CMutex.h
Go to the documentation of this file.
1 /*================================================================================================*/
2 /*
3  *
4  * Copyright 2014-2015 by Avid Technology, Inc.
5  * All rights reserved.
6  *
7  * CONFIDENTIAL: This document contains confidential information. Do not
8  * read or examine this document unless you are an Avid Technology employee
9  * or have signed a non-disclosure agreement with Avid Technology which protects
10  * the confidentiality of this document. DO NOT DISCLOSE ANY INFORMATION
11  * CONTAINED IN THIS DOCUMENT TO ANY THIRD-PARTY WITHOUT THE PRIOR WRITTEN CONSENT
12  * OF Avid Technology, INC.
13  *
14  */
15 
16 #ifndef AAX_CMUTEX_H
17 #define AAX_CMUTEX_H
18 
25 /*================================================================================================*/
26 
30 {
31 public:
34 
35  bool Lock();
36  void Unlock();
37  bool Try_Lock();
38 
39 private:
40  AAX_CMutex(const AAX_CMutex&);
41  AAX_CMutex& operator=(const AAX_CMutex&);
42 
43  typedef struct opaque_aax_mutex_t * aax_mutex_t;
44  aax_mutex_t mMutex;
45 };
46 
50 {
51 public:
52  explicit AAX_StLock_Guard(AAX_CMutex& iMutex) : mMutex(iMutex) { mNeedsUnlock = mMutex.Lock(); }
53  ~AAX_StLock_Guard() { if (mNeedsUnlock) mMutex.Unlock(); }
54 
55 private:
57  AAX_StLock_Guard& operator=(AAX_StLock_Guard const&);
58 
59  AAX_CMutex & mMutex;
60  bool mNeedsUnlock;
61 };
62 
63 #endif // AAX_CMUTEX_H
64 
Mutex with try lock functionality.
Definition: AAX_CMutex.h:30
void Unlock()
bool Lock()
bool Try_Lock()
Helper class for working with mutex.
Definition: AAX_CMutex.h:50
~AAX_StLock_Guard()
Definition: AAX_CMutex.h:53
AAX_StLock_Guard(AAX_CMutex &iMutex)
Definition: AAX_CMutex.h:52