| AAX SDK 2.8.0 Avid Audio Extensions Development Kit

- Welcome
- Manual
- Classes
- Files
- Lists
- Support

- File List
- File Members

Loading...
Searching...
No Matches
AAX_CMutex.h
Go to the documentation of this file.
1/*================================================================================================*/
2/*
3 *
4 * Copyright 2014-2015, 2023-2024 Avid Technology, Inc.
5 * All rights reserved.
6 *
7 * This file is part of the Avid AAX SDK.
8 *
9 * The AAX SDK is subject to commercial or open-source licensing.
10 *
11 * By using the AAX SDK, you agree to the terms of both the Avid AAX SDK License
12 * Agreement and Avid Privacy Policy.
13 *
14 * AAX SDK License: https://developer.avid.com/aax
15 * Privacy Policy: https://www.avid.com/legal/privacy-policy-statement
16 *
17 * Or: You may also use this code under the terms of the GPL v3 (see
18 * www.gnu.org/licenses).
19 *
20 * THE AAX SDK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
21 * EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
22 * DISCLAIMED.
23 *
24 */
25
26#ifndef AAX_CMUTEX_H
27#define AAX_CMUTEX_H
28
35/*================================================================================================*/
36
39 class AAX_CMutex
40{
41 public:
42 AAX_CMutex();
43 ~AAX_CMutex();
44
45 bool Lock();
46 void Unlock();
47 bool Try_Lock();
48
49 private:
50 AAX_CMutex(const AAX_CMutex&);
51 AAX_CMutex& operator=(const AAX_CMutex&);
52
53 typedef struct opaque_aax_mutex_t * aax_mutex_t;
54 aax_mutex_t mMutex;
55};
56
59 class AAX_StLock_Guard
60{
61 public:
62 explicit AAX_StLock_Guard(AAX_CMutex& iMutex) : mMutex(iMutex) { mNeedsUnlock = mMutex.Lock(); }
63 ~AAX_StLock_Guard() { if (mNeedsUnlock) mMutex.Unlock(); }
64
65 private:
66 AAX_StLock_Guard(AAX_StLock_Guard const&);
67 AAX_StLock_Guard& operator=(AAX_StLock_Guard const&);
68
69 AAX_CMutex & mMutex;
70 bool mNeedsUnlock;
71};
72
73#endif // AAX_CMUTEX_H
74
AAX_CMutex
Mutex with try lock functionality.
Definition: AAX_CMutex.h:40
AAX_CMutex::~AAX_CMutex
~AAX_CMutex()
AAX_CMutex::AAX_CMutex
AAX_CMutex()
AAX_CMutex::Unlock
void Unlock()
AAX_CMutex::Lock
bool Lock()
AAX_CMutex::Try_Lock
bool Try_Lock()
AAX_StLock_Guard
Helper class for working with mutex.
Definition: AAX_CMutex.h:60
AAX_StLock_Guard::~AAX_StLock_Guard
~AAX_StLock_Guard()
Definition: AAX_CMutex.h:63
AAX_StLock_Guard::AAX_StLock_Guard
AAX_StLock_Guard(AAX_CMutex &iMutex)
Definition: AAX_CMutex.h:62