Commit b6af7abb authored by Max Kellermann's avatar Max Kellermann

thread/PosixMutex: add "noexcept"

parent edee8a34
...@@ -48,11 +48,11 @@ public: ...@@ -48,11 +48,11 @@ public:
#else #else
/* slow fallback for pthread implementations that are not /* slow fallback for pthread implementations that are not
compatible with "constexpr" */ compatible with "constexpr" */
PosixMutex() { PosixMutex() noexcept {
pthread_mutex_init(&mutex, nullptr); pthread_mutex_init(&mutex, nullptr);
} }
~PosixMutex() { ~PosixMutex() noexcept {
pthread_mutex_destroy(&mutex); pthread_mutex_destroy(&mutex);
} }
#endif #endif
...@@ -60,15 +60,15 @@ public: ...@@ -60,15 +60,15 @@ public:
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() noexcept {
pthread_mutex_lock(&mutex); pthread_mutex_lock(&mutex);
} }
bool try_lock() { bool try_lock() noexcept {
return pthread_mutex_trylock(&mutex) == 0; return pthread_mutex_trylock(&mutex) == 0;
} }
void unlock() { void unlock() noexcept {
pthread_mutex_unlock(&mutex); pthread_mutex_unlock(&mutex);
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment