openshot-audio  0.1.6
juce_CriticalSection.h
Go to the documentation of this file.
1 /*
2  ==============================================================================
3 
4  This file is part of the juce_core module of the JUCE library.
5  Copyright (c) 2015 - ROLI Ltd.
6 
7  Permission to use, copy, modify, and/or distribute this software for any purpose with
8  or without fee is hereby granted, provided that the above copyright notice and this
9  permission notice appear in all copies.
10 
11  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
12  TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
13  NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
15  IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
16  CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 
18  ------------------------------------------------------------------------------
19 
20  NOTE! This permissive ISC license applies ONLY to files within the juce_core module!
21  All other JUCE modules are covered by a dual GPL/commercial license, so if you are
22  using any other modules, be sure to check that you also comply with their license.
23 
24  For more details, visit www.juce.com
25 
26  ==============================================================================
27 */
28 
29 #ifndef JUCE_CRITICALSECTION_H_INCLUDED
30 #define JUCE_CRITICALSECTION_H_INCLUDED
31 
32 
33 //==============================================================================
48 {
49 public:
50  //==============================================================================
53 
59 
60  //==============================================================================
71  void enter() const noexcept;
72 
81  bool tryEnter() const noexcept;
82 
93  void exit() const noexcept;
94 
95 
96  //==============================================================================
99 
102 
105 
106 
107 private:
108  //==============================================================================
109  #if JUCE_WINDOWS
110  // To avoid including windows.h in the public JUCE headers, we'll just allocate
111  // a block of memory here that's big enough to be used internally as a windows
112  // CRITICAL_SECTION structure.
113  #if JUCE_64BIT
114  uint8 lock[44];
115  #else
116  uint8 lock[24];
117  #endif
118  #else
119  mutable pthread_mutex_t lock;
120  #endif
121 
123 };
124 
125 
126 //==============================================================================
137 {
138 public:
141 
142  inline void enter() const noexcept {}
143  inline bool tryEnter() const noexcept { return true; }
144  inline void exit() const noexcept {}
145 
146  //==============================================================================
149  {
151  };
152 
155 
156 private:
158 };
159 
160 //==============================================================================
190 
191 //==============================================================================
230 
231 //==============================================================================
264 
265 
266 #endif // JUCE_CRITICALSECTION_H_INCLUDED
#define noexcept
Definition: juce_CompilerSupport.h:141
GenericScopedLock< CriticalSection > ScopedLockType
Definition: juce_CriticalSection.h:98
ScopedLockType ScopedUnlockType
Definition: juce_CriticalSection.h:154
Definition: juce_ScopedLock.h:59
Definition: juce_ScopedLock.h:128
Definition: juce_ScopedLock.h:198
bool tryEnter() const noexcept
Definition: juce_CriticalSection.h:143
#define JUCE_API
Definition: juce_StandardHeader.h:139
Definition: juce_CriticalSection.h:47
CriticalSection::ScopedTryLockType ScopedTryLock
Definition: juce_CriticalSection.h:263
CriticalSection::ScopedLockType ScopedLock
Definition: juce_CriticalSection.h:189
void exit() const noexcept
Definition: juce_CriticalSection.h:144
GenericScopedTryLock< CriticalSection > ScopedTryLockType
Definition: juce_CriticalSection.h:104
Definition: juce_CriticalSection.h:148
void enter() const noexcept
Definition: juce_CriticalSection.h:142
#define JUCE_DECLARE_NON_COPYABLE(className)
Definition: juce_PlatformDefs.h:191
~DummyCriticalSection() noexcept
Definition: juce_CriticalSection.h:140
CriticalSection::ScopedUnlockType ScopedUnlock
Definition: juce_CriticalSection.h:229
Definition: juce_CriticalSection.h:136
ScopedLockType(const DummyCriticalSection &) noexcept
Definition: juce_CriticalSection.h:150
unsigned char uint8
Definition: juce_MathsFunctions.h:43
DummyCriticalSection() noexcept
Definition: juce_CriticalSection.h:139
GenericScopedUnlock< CriticalSection > ScopedUnlockType
Definition: juce_CriticalSection.h:101