mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-06 18:00:17 +02:00
SignalScopeGuards: Review
This commit is contained in:
1 file changed
+6
-10
@@ -45,12 +45,10 @@ public:
|
||||
Mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
}
|
||||
|
||||
// Checks and asserts if the mutex isn't owned by the calling thread.
|
||||
// Asserts that the mutex isn't exclusively owned by the calling thread.
|
||||
void check_lock_owned_by_self() {
|
||||
const auto Result = pthread_mutex_lock(&Mutex);
|
||||
if (Result == 0) [[unlikely]] {
|
||||
ERROR_AND_DIE_FMT("User of unique lock must have already locked mutex as write!");
|
||||
}
|
||||
[[maybe_unused]] const auto Result = pthread_mutex_lock(&Mutex);
|
||||
LOGMAN_THROW_A_FMT(Result == EDEADLK, "User of unique lock must have already locked mutex as write!");
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -95,12 +93,10 @@ public:
|
||||
return Result == 0;
|
||||
}
|
||||
|
||||
// Checks and asserts if the rwlock isn't owned by the calling thread with write semantics.
|
||||
// Asserts that the rwlock isn't exclusively owned by the calling thread.
|
||||
void check_lock_owned_by_self_as_write() {
|
||||
const auto Result = pthread_rwlock_wrlock(&Mutex);
|
||||
if (Result == 0) [[unlikely]] {
|
||||
ERROR_AND_DIE_FMT("User of rwlock must have already locked mutex as write!");
|
||||
}
|
||||
[[maybe_unused]] const auto Result = pthread_rwlock_wrlock(&Mutex);
|
||||
LOGMAN_THROW_A_FMT(Result == EDEADLK, "User of rwlock must have already locked mutex as write!");
|
||||
}
|
||||
|
||||
// Initialize the internal pthread object to its default initializer state.
|
||||
|
||||
Reference in new issue
Block a user