JUCE  v5.1.1-3-g1a0b28c73
JUCE API
InterProcessLock Class Reference

Acts as a critical section which processes can use to block each other. More...

#include <juce_InterProcessLock.h>

Collaboration diagram for InterProcessLock:

Classes

class  Pimpl
 
class  ScopedLockType
 Automatically locks and unlocks an InterProcessLock object. More...
 

Public Member Functions

 InterProcessLock (const String &name)
 Creates a lock object. More...
 
 ~InterProcessLock ()
 Destructor. More...
 
bool enter (int timeOutMillisecs=-1)
 Attempts to lock the critical section. More...
 
void exit ()
 Releases the lock if it's currently held by this process. More...
 

Private Attributes

CriticalSection lock
 
String name
 
ScopedPointer< Pimplpimpl
 

Friends

struct ContainerDeletePolicy< Pimpl >
 

Detailed Description

Acts as a critical section which processes can use to block each other.

See also
CriticalSection

Constructor & Destructor Documentation

◆ InterProcessLock()

InterProcessLock::InterProcessLock ( const String name)
explicit

Creates a lock object.

Parameters
namea name that processes will use to identify this lock object

◆ ~InterProcessLock()

InterProcessLock::~InterProcessLock ( )

Destructor.

This will also release the lock if it's currently held by this process.

Member Function Documentation

◆ enter()

bool InterProcessLock::enter ( int  timeOutMillisecs = -1)

Attempts to lock the critical section.

Parameters
timeOutMillisecshow many milliseconds to wait if the lock is already held by another process - a value of 0 will return immediately, negative values will wait forever
Returns
true if the lock could be gained within the timeout period, or false if the timeout expired.

References InterProcessLock::Pimpl::handle, lock, name, pimpl, and InterProcessLock::Pimpl::refCount.

Referenced by InterProcessLock::ScopedLockType::ScopedLockType().

◆ exit()

void InterProcessLock::exit ( )

Releases the lock if it's currently held by this process.

References androidJNIJavaVM, jassert, juce_threadEntryPoint(), lock, pimpl, InterProcessLock::Pimpl::refCount, and threadEntryProc().

Referenced by ChildProcess::ActiveProcess::ActiveProcess().

Friends And Related Function Documentation

◆ ContainerDeletePolicy< Pimpl >

friend struct ContainerDeletePolicy< Pimpl >
friend

Member Data Documentation

◆ lock

CriticalSection InterProcessLock::lock
private

Referenced by enter(), and exit().

◆ name

String InterProcessLock::name
private

Referenced by enter().

◆ pimpl

ScopedPointer<Pimpl> InterProcessLock::pimpl
private

Referenced by enter(), and exit().


The documentation for this class was generated from the following files: