thread/PosixMutex: fix indent
This commit is contained in:
parent
ea25e0ee55
commit
51a8c109ab
@ -36,25 +36,25 @@
|
|||||||
* Low-level wrapper for a pthread_mutex_t.
|
* Low-level wrapper for a pthread_mutex_t.
|
||||||
*/
|
*/
|
||||||
class PosixMutex {
|
class PosixMutex {
|
||||||
pthread_mutex_t mutex;
|
pthread_mutex_t mutex;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
constexpr PosixMutex():mutex(PTHREAD_MUTEX_INITIALIZER) {}
|
constexpr PosixMutex():mutex(PTHREAD_MUTEX_INITIALIZER) {}
|
||||||
|
|
||||||
PosixMutex(const PosixMutex &other) = delete;
|
PosixMutex(const PosixMutex &other) = delete;
|
||||||
PosixMutex &operator=(const PosixMutex &other) = delete;
|
PosixMutex &operator=(const PosixMutex &other) = delete;
|
||||||
|
|
||||||
void lock() {
|
void lock() {
|
||||||
pthread_mutex_lock(&mutex);
|
pthread_mutex_lock(&mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool try_lock() {
|
bool try_lock() {
|
||||||
return pthread_mutex_trylock(&mutex) == 0;
|
return pthread_mutex_trylock(&mutex) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void unlock() {
|
void unlock() {
|
||||||
pthread_mutex_unlock(&mutex);
|
pthread_mutex_unlock(&mutex);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user