A named inter-process semaphore. More...
#include <shmem_carrier/ShmemPlatform.h>
Public Member Functions | |
| NamedSemaphore ()=default | |
| ~NamedSemaphore () | |
| NamedSemaphore (const NamedSemaphore &)=delete | |
| NamedSemaphore & | operator= (const NamedSemaphore &)=delete |
| bool | create (const std::string &name, unsigned int initial, unsigned int max) |
| Create a new semaphore (removing any stale semaphore with the same name) | |
| bool | open (const std::string &name) |
| Open an existing semaphore. | |
| void | close () |
| bool | wait () |
| Wait until the semaphore is available. | |
| bool | waitFor (double timeout) |
| Wait at most timeout seconds. Returns true if the semaphore was acquired. | |
| bool | post () |
Static Public Member Functions | |
| static void | unlink (const std::string &name) |
| Remove the name of the semaphore (no-op on Windows) | |
A named inter-process semaphore.
Unlike a process mutex, it can be released by any thread of any process.
Definition at line 63 of file ShmemPlatform.h.
|
default |
| shmem::NamedSemaphore::~NamedSemaphore | ( | ) |
Definition at line 328 of file ShmemPlatform.cpp.
|
delete |
| void shmem::NamedSemaphore::close | ( | ) |
Definition at line 438 of file ShmemPlatform.cpp.
| bool shmem::NamedSemaphore::create | ( | const std::string & | name, |
| unsigned int | initial, | ||
| unsigned int | max | ||
| ) |
Create a new semaphore (removing any stale semaphore with the same name)
Definition at line 408 of file ShmemPlatform.cpp.
| bool shmem::NamedSemaphore::open | ( | const std::string & | name | ) |
Open an existing semaphore.
Definition at line 425 of file ShmemPlatform.cpp.
|
delete |
| bool shmem::NamedSemaphore::post | ( | ) |
Definition at line 506 of file ShmemPlatform.cpp.
|
static |
Remove the name of the semaphore (no-op on Windows)
Definition at line 446 of file ShmemPlatform.cpp.
| bool shmem::NamedSemaphore::wait | ( | ) |
Wait until the semaphore is available.
Definition at line 451 of file ShmemPlatform.cpp.
| bool shmem::NamedSemaphore::waitFor | ( | double | timeout | ) |
Wait at most timeout seconds. Returns true if the semaphore was acquired.
Definition at line 464 of file ShmemPlatform.cpp.