|
Gin
|
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. | |
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.
| 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.
| name | The unique name identifying this semaphore across the system |
| SystemSemaphore::~SystemSemaphore | ( | ) |
Destructor.
Releases the semaphore.
| 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.
| bool SystemSemaphore::unlock | ( | ) |
Unlocks the semaphore, making it available to other processes.
| bool SystemSemaphore::isValid | ( | ) |
Checks if the semaphore was created/opened successfully.