Gin
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SystemSemaphore Class Reference

A system-wide semaphore for inter-process synchronization. More...

#include <gin_systemsemaphore.h>

Public Member Functions

 SystemSemaphore (const juce::String &name)
 Creates or opens a system-wide semaphore with the given name.
 
 ~SystemSemaphore ()
 Destructor.
 
bool lock ()
 Locks the semaphore, blocking until it becomes available.
 
bool unlock ()
 Unlocks the semaphore, making it available to other processes.
 
bool isValid ()
 Checks if the semaphore was created/opened successfully.
 

Detailed Description

A system-wide semaphore for inter-process synchronization.

This class provides a named semaphore that can be shared between multiple processes on the same system. Unlike regular threading primitives, this semaphore persists at the OS level and can be accessed by any process that knows its name.

Warning
This class is not yet fully implemented and should be used with caution.
See also
lock, unlock, isValid

Constructor & Destructor Documentation

◆ SystemSemaphore()

SystemSemaphore::SystemSemaphore ( const juce::String &  name)

Creates or opens a system-wide semaphore with the given name.

If a semaphore with this name already exists, it will be opened. Otherwise, a new semaphore will be created.

Parameters
nameThe unique name identifying this semaphore across the system

◆ ~SystemSemaphore()

SystemSemaphore::~SystemSemaphore ( )

Destructor.

Releases the semaphore.

Member Function Documentation

◆ lock()

bool SystemSemaphore::lock ( )

Locks the semaphore, blocking until it becomes available.

If another process has locked this semaphore, this call will block until that process unlocks it.

Returns
true if the lock was acquired successfully, false on error

◆ unlock()

bool SystemSemaphore::unlock ( )

Unlocks the semaphore, making it available to other processes.

Returns
true if the unlock succeeded, false on error

◆ isValid()

bool SystemSemaphore::isValid ( )

Checks if the semaphore was created/opened successfully.

Returns
true if the semaphore is valid and can be used, false otherwise

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