stratosphere: Use RAII for locks
This renames the Mutex class member functions so that the mutex types satisfy Lockable. This makes them usable with standard std::scoped_lock and std::unique_lock, which lets us use RAII and avoids the need for a custom RAII wrapper :)
This commit is contained in:
1 parent
18153713d9
commit
5b3e8e1c5d
11 files changed
+52
-91
No files matched your search
@@ -9,15 +9,15 @@ class HosMutex {
|
||||
mutexInit(&this->m);
|
||||
}
|
||||
|
||||
void Lock() {
|
||||
void lock() {
|
||||
mutexLock(&this->m);
|
||||
}
|
||||
|
||||
void Unlock() {
|
||||
void unlock() {
|
||||
mutexUnlock(&this->m);
|
||||
}
|
||||
|
||||
bool TryLock() {
|
||||
bool try_lock() {
|
||||
return mutexTryLock(&this->m);
|
||||
}
|
||||
};
|
||||
@@ -30,15 +30,15 @@ class HosRecursiveMutex {
|
||||
rmutexInit(&this->m);
|
||||
}
|
||||
|
||||
void Lock() {
|
||||
void lock() {
|
||||
rmutexLock(&this->m);
|
||||
}
|
||||
|
||||
void Unlock() {
|
||||
void unlock() {
|
||||
rmutexUnlock(&this->m);
|
||||
}
|
||||
|
||||
bool TryLock() {
|
||||
bool try_lock() {
|
||||
return rmutexTryLock(&this->m);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user