OpenShot Audio Library | OpenShotAudio 0.3.2
Loading...
Searching...
No Matches
juce_CriticalSection.h
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2017 - ROLI Ltd.
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 The code included in this file is provided under the terms of the ISC license
11 http://www.isc.org/downloads/software-support-policy/isc-license. Permission
12 To use, copy, modify, and/or distribute this software for any purpose with or
13 without fee is hereby granted provided that the above copyright notice and
14 this permission notice appear in all copies.
15
16 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
17 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
18 DISCLAIMED.
19
20 ==============================================================================
21*/
22
23namespace juce
24{
25
26//==============================================================================
42class JUCE_API CriticalSection
43{
44public:
45 //==============================================================================
48
54
55 //==============================================================================
66 void enter() const noexcept;
67
76 bool tryEnter() const noexcept;
77
88 void exit() const noexcept;
89
90
91 //==============================================================================
94
97
100
101
102private:
103 //==============================================================================
104 #if JUCE_WINDOWS
105 // To avoid including windows.h in the public JUCE headers, we'll just allocate
106 // a block of memory here that's big enough to be used internally as a windows
107 // CRITICAL_SECTION structure.
108 #if JUCE_64BIT
109 uint8 lock[44];
110 #else
111 uint8 lock[24];
112 #endif
113 #else
114 mutable pthread_mutex_t lock;
115 #endif
116
117 JUCE_DECLARE_NON_COPYABLE (CriticalSection)
118};
119
120
121//==============================================================================
134{
135public:
136 inline DummyCriticalSection() = default;
137 inline ~DummyCriticalSection() = default;
138
139 inline void enter() const noexcept {}
140 inline bool tryEnter() const noexcept { return true; }
141 inline void exit() const noexcept {}
142
143 //==============================================================================
146 {
147 ScopedLockType (const DummyCriticalSection&) noexcept {}
148 };
149
152
153private:
154 JUCE_DECLARE_NON_COPYABLE (DummyCriticalSection)
155};
156
157//==============================================================================
187
188//==============================================================================
227
228//==============================================================================
261
262} // namespace juce
GenericScopedLock< CriticalSection > ScopedLockType
GenericScopedUnlock< CriticalSection > ScopedUnlockType
CriticalSection() noexcept
GenericScopedTryLock< CriticalSection > ScopedTryLockType