12#ifndef ROC_CORE_MUTEX_H_
13#define ROC_CORE_MUTEX_H_
43 const int err = pthread_mutex_trylock(&mutex_);
45 if (err != 0 && err != EBUSY && err != EAGAIN) {
54 if (
int err = pthread_mutex_lock(&mutex_)) {
63 if (
int err = pthread_mutex_unlock(&mutex_)) {
73 mutable pthread_mutex_t mutex_;
Atomic integer. Provides sequential consistency. For a fine-grained memory order control,...
bool try_lock() const
Try to lock the mutex.
ScopedLock< Mutex > Lock
RAII lock.
void unlock() const
Unlock mutex.
void lock() const
Lock mutex.
Base class for non-copyable objects.
#define roc_panic(...)
Print error message and terminate program gracefully.