mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2025-06-12 22:38:10 -05:00
hle: kernel: KThread: Ensure host (dummy) threads block on locking.
- But do not enter the priority queue, as otherwise they will be scheduled. - Allows dummy threads to use guest synchronization primitives.
This commit is contained in:
@ -558,6 +558,10 @@ public:
|
||||
return thread_type;
|
||||
}
|
||||
|
||||
[[nodiscard]] bool IsDummyThread() const {
|
||||
return GetThreadType() == ThreadType::Dummy;
|
||||
}
|
||||
|
||||
void SetWaitObjectsForDebugging(const std::span<KSynchronizationObject*>& objects) {
|
||||
wait_objects_for_debugging.clear();
|
||||
wait_objects_for_debugging.reserve(objects.size());
|
||||
@ -632,6 +636,14 @@ public:
|
||||
return condvar_key;
|
||||
}
|
||||
|
||||
// Dummy threads (used for HLE host threads) cannot wait based on the guest scheduler, and
|
||||
// therefore will not block on guest kernel synchronization primitives. These methods handle
|
||||
// blocking as needed.
|
||||
|
||||
void IfDummyThreadTryWait();
|
||||
void IfDummyThreadBeginWait();
|
||||
void IfDummyThreadEndWait();
|
||||
|
||||
private:
|
||||
static constexpr size_t PriorityInheritanceCountMax = 10;
|
||||
union SyncObjectBuffer {
|
||||
@ -750,6 +762,7 @@ private:
|
||||
bool resource_limit_release_hint{};
|
||||
StackParameters stack_parameters{};
|
||||
KSpinLock context_guard{};
|
||||
KSpinLock dummy_wait_lock{};
|
||||
|
||||
// For emulation
|
||||
std::shared_ptr<Common::Fiber> host_context{};
|
||||
|
Reference in New Issue
Block a user