Create a lock around a boolean semaphore region.
More...
#include <Lock.h>
Create a lock around a boolean semaphore region.
- See also
- tarch::multicore::BooleanSemaphore
Definition at line 19 of file Lock.h.
◆ Lock()
Create lock around semaphore.
- Parameters
-
| aquireLockImmediately | If set, the constructor locks the semaphore immediately when you construct the object. If the parameter is overwritten with false, you have to use the lock's lock() operation. |
| freeLockInDestructor | If set and if the lock has locked the semaphore, it will free it in the destructor unless you have manually unlocked it before. This parameter should be altered very carefully. |
◆ ~Lock()
| tarch::multicore::Lock::~Lock |
( |
| ) |
|
◆ free()
| void tarch::multicore::Lock::free |
( |
| ) |
|
Free the lock.
There is an assertion here that checks if you have acquired the lock before. When people use the locks to wrap around the semaphore and to alter it manually, i.e. when they disable the automatic lock management in the constructor by unsetting freeLockInDestructor, then these checks are not valid anymore.
◆ lock()
| void tarch::multicore::Lock::lock |
( |
| ) |
|
◆ tryLock()
| bool tarch::multicore::Lock::tryLock |
( |
| ) |
|
◆ _freeLockInDestructor
| const bool tarch::multicore::Lock::_freeLockInDestructor |
|
private |
◆ _lockIsAquired
| bool tarch::multicore::Lock::_lockIsAquired |
|
private |
◆ _semaphore
The documentation for this class was generated from the following file: