This class implements a lock shared over individual processes (a system-wide lock).
More...
#include <SharedLock.h>
|
| | SharedLock ()=default |
| | Creates an invalid shared lock object.
|
| |
| | SharedLock (const std::wstring &name) |
| | Creates a new shared lock object by a system unique name of this lock.
|
| |
| | SharedLock (const SharedLock &sharedLock)=delete |
| | Disabled copy constructor.
|
| |
| | ~SharedLock () |
| | Destructs a shared lock object.
|
| |
| const std::wstring & | name () const |
| | Returns the system wide unique name of this lock.
|
| |
| void | lock () |
| | Looks the mutex.
|
| |
| bool | tryLock () |
| | Tries to lock the mutex.
|
| |
| void | unlock () |
| | Unlocks the mutex.
|
| |
| bool | isValid () const |
| | Returns whether this object is valid and can be used correctly.
|
| |
| | operator bool () const |
| | Returns whether this object is valid and can be used correctly.
|
| |
| SharedLock & | operator= (const SharedLock &sharedLock)=delete |
| | Disabled assign operator.
|
| |
This class implements a lock shared over individual processes (a system-wide lock).
- See also
- ScopedSharedLock, SharedMemory.
◆ SharedLock() [1/3]
| Ocean::SharedLock::SharedLock |
( |
| ) |
|
|
default |
Creates an invalid shared lock object.
◆ SharedLock() [2/3]
| Ocean::SharedLock::SharedLock |
( |
const std::wstring & |
name | ) |
|
|
explicit |
Creates a new shared lock object by a system unique name of this lock.
- Parameters
-
| name | System wide unique lock name |
◆ SharedLock() [3/3]
| Ocean::SharedLock::SharedLock |
( |
const SharedLock & |
sharedLock | ) |
|
|
delete |
Disabled copy constructor.
- Parameters
-
| sharedLock | Shared lock object to be copied |
◆ ~SharedLock()
| Ocean::SharedLock::~SharedLock |
( |
| ) |
|
Destructs a shared lock object.
◆ createSemaphore()
| bool Ocean::SharedLock::createSemaphore |
( |
| ) |
|
|
private |
Creates the semaphore object of this lock.
- Returns
- True, if succeeded
◆ isValid()
| bool Ocean::SharedLock::isValid |
( |
| ) |
const |
|
inline |
Returns whether this object is valid and can be used correctly.
- Returns
- True, if so
◆ lock()
| void Ocean::SharedLock::lock |
( |
| ) |
|
◆ name()
| const std::wstring & Ocean::SharedLock::name |
( |
| ) |
const |
|
inline |
Returns the system wide unique name of this lock.
- Returns
- Lock name
◆ operator bool()
| Ocean::SharedLock::operator bool |
( |
| ) |
const |
|
inlineexplicit |
Returns whether this object is valid and can be used correctly.
- Returns
- True, if so
◆ operator=()
Disabled assign operator.
- Parameters
-
| sharedLock | Shared lock object to be assigned |
- Returns
- Reference to this object
◆ tryLock()
| bool Ocean::SharedLock::tryLock |
( |
| ) |
|
Tries to lock the mutex.
Beware: This object must have a valid name before locking!
- Returns
- True, if the mutex could be locked
- See also
- unlock(), lock(), name(), isValid().
◆ unlock()
| void Ocean::SharedLock::unlock |
( |
| ) |
|
Unlocks the mutex.
Beware: This object must have a valid name before locking!
- See also
- lock(), name(), isVaid().
◆ handle_
| void* Ocean::SharedLock::handle_ = nullptr |
|
private |
◆ localCounter_
| unsigned int Ocean::SharedLock::localCounter_ = 0u |
|
private |
◆ localLock_
| Lock Ocean::SharedLock::localLock_ |
|
private |
◆ name_
| std::wstring Ocean::SharedLock::name_ |
|
private |
The documentation for this class was generated from the following file: