thread/PosixMutex: add "noexcept"

This commit is contained in:
Max Kellermann 2017-12-18 23:29:08 +01:00
parent edee8a3446
commit b6af7abb1a

View File

@ -48,11 +48,11 @@ public:
#else
/* slow fallback for pthread implementations that are not
compatible with "constexpr" */
PosixMutex() {
PosixMutex() noexcept {
pthread_mutex_init(&mutex, nullptr);
}
~PosixMutex() {
~PosixMutex() noexcept {
pthread_mutex_destroy(&mutex);
}
#endif
@ -60,15 +60,15 @@ public:
PosixMutex(const PosixMutex &other) = delete;
PosixMutex &operator=(const PosixMutex &other) = delete;
void lock() {
void lock() noexcept {
pthread_mutex_lock(&mutex);
}
bool try_lock() {
bool try_lock() noexcept {
return pthread_mutex_trylock(&mutex) == 0;
}
void unlock() {
void unlock() noexcept {
pthread_mutex_unlock(&mutex);
}
};