Loading...
Searching...
No Matches
juce_InterProcessLock.h
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2022 - Raw Material Software Limited
JUCE is an open source library subject to commercial or open-source
licensing.
The code included in this file is provided under the terms of the ISC license
http://www.isc.org/downloads/software-support-policy/isc-license. Permission
To use, copy, modify, and/or distribute this software for any purpose with or
without fee is hereby granted provided that the above copyright notice and
this permission notice appear in all copies.
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
DISCLAIMED.
==============================================================================
*/
namespace juce
{
//==============================================================================
class JUCE_API InterProcessLock
{
public:
//==============================================================================
explicit InterProcessLock (const String& name);
~InterProcessLock();
//==============================================================================
bool enter (int timeOutMillisecs = -1);
void exit();
//==============================================================================
class ScopedLockType
{
public:
//==============================================================================
explicit ScopedLockType (InterProcessLock& l) : ipLock (l) { lockWasSuccessful = l.enter(); }
inline ~ScopedLockType() { ipLock.exit(); }
bool isLocked() const noexcept { return lockWasSuccessful; }
private:
//==============================================================================
InterProcessLock& ipLock;
bool lockWasSuccessful;
JUCE_DECLARE_NON_COPYABLE (ScopedLockType)
};
private:
//==============================================================================
class Pimpl;
std::unique_ptr<Pimpl> pimpl;
CriticalSection lock;
String name;
JUCE_DECLARE_NON_COPYABLE (InterProcessLock)
};
} // namespace juce
juce::CriticalSection
Definition juce_CriticalSection.h:43
juce::InterProcessLock::ScopedLockType
Definition juce_InterProcessLock.h:72
juce::InterProcessLock::ScopedLockType::isLocked
bool isLocked() const noexcept
Definition juce_InterProcessLock.h:100
juce::InterProcessLock::ScopedLockType::ScopedLockType
ScopedLockType(InterProcessLock &l)
Definition juce_InterProcessLock.h:88
juce::InterProcessLock::ScopedLockType::~ScopedLockType
~ScopedLockType()
Definition juce_InterProcessLock.h:97
juce::InterProcessLock
Definition juce_InterProcessLock.h:35
juce::InterProcessLock::~InterProcessLock
~InterProcessLock()
juce::InterProcessLock::exit
void exit()
juce::InterProcessLock::enter
bool enter(int timeOutMillisecs=-1)
juce::InterProcessLock::InterProcessLock
InterProcessLock(const String &name)
juce::String
Definition juce_String.h:53