LMMS
Loading...
Searching...
No Matches
juce_CriticalSection.h
Go to the documentation of this file.
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
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//==============================================================================
43{
44public:
45 //==============================================================================
47 CriticalSection() noexcept;
48
53 ~CriticalSection() noexcept;
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 std::aligned_storage<44, 8>::type lock;
110 #else
111 std::aligned_storage<24, 8>::type lock;
112 #endif
113 #else
114 mutable pthread_mutex_t lock;
115 #endif
116
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 {
148 };
149
152
153private:
155};
156
157//==============================================================================
187
188//==============================================================================
227
228//==============================================================================
261
262} // namespace juce
#define noexcept
Definition DistrhoDefines.h:72
bool tryEnter() const noexcept
Definition juce_posix_SharedCode.h:40
GenericScopedLock< CriticalSection > ScopedLockType
Definition juce_CriticalSection.h:93
GenericScopedUnlock< CriticalSection > ScopedUnlockType
Definition juce_CriticalSection.h:96
CriticalSection() noexcept
Definition juce_posix_SharedCode.h:26
pthread_mutex_t lock
Definition juce_CriticalSection.h:114
GenericScopedTryLock< CriticalSection > ScopedTryLockType
Definition juce_CriticalSection.h:99
void enter() const noexcept
Definition juce_posix_SharedCode.h:39
void exit() const noexcept
Definition juce_CriticalSection.h:141
void enter() const noexcept
Definition juce_CriticalSection.h:139
bool tryEnter() const noexcept
Definition juce_CriticalSection.h:140
ScopedLockType ScopedUnlockType
Definition juce_CriticalSection.h:151
Definition juce_ScopedLock.h:55
Definition juce_ScopedLock.h:198
Definition juce_ScopedLock.h:126
CARLA_PLUGIN_EXPORT void exit(int status)
Definition interposer-safe.cpp:70
#define JUCE_DECLARE_NON_COPYABLE(className)
#define JUCE_API
Definition juce_StandardHeader.h:152
Definition carla_juce.cpp:31
CriticalSection::ScopedLockType ScopedLock
Definition juce_CriticalSection.h:186
CriticalSection::ScopedTryLockType ScopedTryLock
Definition juce_CriticalSection.h:260
CriticalSection::ScopedUnlockType ScopedUnlock
Definition juce_CriticalSection.h:226
Definition juce_CriticalSection.h:146
ScopedLockType(const DummyCriticalSection &) noexcept
Definition juce_CriticalSection.h:147
#define const
Definition zconf.h:137