Browse Source

Added an isLocked() method to ReadWriteLock that checks whether ReadWriteLock is currently locked

tags/2021-05-28
ed 8 years ago
parent
commit
f301ed7e09
2 changed files with 12 additions and 0 deletions
  1. +6
    -0
      modules/juce_core/threads/juce_ReadWriteLock.cpp
  2. +6
    -0
      modules/juce_core/threads/juce_ReadWriteLock.h

+ 6
- 0
modules/juce_core/threads/juce_ReadWriteLock.cpp View File

@@ -148,3 +148,9 @@ void ReadWriteLock::exitWrite() const noexcept
waitEvent.signal();
}
}
//==============================================================================
bool ReadWriteLock::isLocked() const noexcept
{
return numWriters != 0;
}

+ 6
- 0
modules/juce_core/threads/juce_ReadWriteLock.h View File

@@ -127,6 +127,12 @@ public:
*/
void exitWrite() const noexcept;
//==============================================================================
/** Checks whether this object is locked.
@returns true if the object is currently locked.
*/
bool isLocked() const noexcept;
private:
//==============================================================================


Loading…
Cancel
Save