Allow the kernel dispatch thread to be suspended after being initialized

This commit is contained in:
Dr. Chat 2016-11-23 11:56:57 -06:00
parent d5010fb947
commit a88c78eba3
1 changed files with 3 additions and 2 deletions

View File

@ -330,6 +330,9 @@ void KernelState::SetExecutableModule(object_ref<UserModule> module) {
dispatch_thread_running_ = true; dispatch_thread_running_ = true;
dispatch_thread_ = dispatch_thread_ =
object_ref<XHostThread>(new XHostThread(this, 128 * 1024, 0, [this]() { object_ref<XHostThread>(new XHostThread(this, 128 * 1024, 0, [this]() {
// As we run guest callbacks the debugger must be able to suspend us.
dispatch_thread_->set_can_debugger_suspend(true);
while (dispatch_thread_running_) { while (dispatch_thread_running_) {
auto global_lock = global_critical_region_.Acquire(); auto global_lock = global_critical_region_.Acquire();
if (dispatch_queue_.empty()) { if (dispatch_queue_.empty()) {
@ -344,8 +347,6 @@ void KernelState::SetExecutableModule(object_ref<UserModule> module) {
} }
return 0; return 0;
})); }));
// As we run guest callbacks the debugger must be able to suspend us.
dispatch_thread_->set_can_debugger_suspend(true);
dispatch_thread_->set_name("Kernel Dispatch Thread"); dispatch_thread_->set_name("Kernel Dispatch Thread");
dispatch_thread_->Create(); dispatch_thread_->Create();
} }