Jetson Inference
DNN Vision Library
|
A lightweight mutual exclusion lock. More...
#include <Mutex.h>
Public Member Functions | |
Mutex () | |
Constructor. More... | |
~Mutex () | |
Destructor. More... | |
bool | AttemptLock () |
If the lock is free, aquire it. More... | |
void | Lock () |
Aquire the lock, whenever it becomes available. More... | |
void | Unlock () |
Release the lock. More... | |
void | Sync () |
Wait for the lock, then release it immediately. More... | |
pthread_mutex_t * | GetID () |
Get the mutex object. More... | |
Protected Attributes | |
pthread_mutex_t | mID |
A lightweight mutual exclusion lock.
It is very fast to check if the mutex is available, lock it, and release it. However, if the mutex is unavailable when you attempt to lock it, execution of the thread will stop until it becomes available.
|
inline |
Constructor.
|
inline |
Destructor.
|
inline |
If the lock is free, aquire it.
Otherwise, return without waiting for it to become available.
|
inline |
Get the mutex object.
|
inline |
Aquire the lock, whenever it becomes available.
This could mean just a few instructions if the lock is already free, or to block the thread if it isn't.
|
inline |
Wait for the lock, then release it immediately.
Use this in situations where you are waiting for an event to occur.
|
inline |
Release the lock.
|
protected |