Use scoped_lock, etc

This commit is contained in:
TuxSH authored and Michael Scire committed 2019-06-03 17:41:03 -07:00
1 parent 698fa9fcb0
commit cd1f74154d
7 files changed
+21 -21

No files matched your search

+4 -4
View File
@@ -20,7 +20,7 @@ SharedPtr<KAutoObject> KHandleTable::GetAutoObject(Handle handle) const
// Note: official kernel locks the spinlock here, but we don't need to.
return nullptr;
} else {
std::lock_guard guard{spinlock};
std::scoped_lock guard{spinlock};
return IsValid(handle) ? entries[handle.index].object : nullptr;
}
}
@@ -50,7 +50,7 @@ bool KHandleTable::Close(Handle handle)
if (handle.IsAliasOrFree()) {
return false;
} else {
std::lock_guard guard{spinlock};
std::scoped_lock guard{spinlock};
if (IsValid(handle)) {
entries[-firstFreeIndex].id = firstFreeIndex;
firstFreeIndex = -(s16)handle.index;
@@ -67,7 +67,7 @@ bool KHandleTable::Generate(Handle &out, SharedPtr<KAutoObject> obj)
{
// Note: nullptr is accepted, for deferred-init.
std::lock_guard guard{spinlock};
std::scoped_lock guard{spinlock};
if (numActive >= capacity) {
return false; // caller should return 0xD201
}
@@ -93,7 +93,7 @@ bool KHandleTable::Generate(Handle &out, SharedPtr<KAutoObject> obj)
bool KHandleTable::Set(SharedPtr<KAutoObject> obj, Handle handle)
{
if (!handle.IsAliasOrFree() && IsValid(handle)) {
std::lock_guard guard{spinlock};
std::scoped_lock guard{spinlock};
entries[handle.index].object = std::move(obj);
return true;
} else {