mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-19 03:33:56 +00:00
Better thread yield support
This commit is contained in:
@@ -2423,9 +2423,7 @@ namespace
|
||||
t.await_time = convert_delay_interval_to_time_point(timeout.read());
|
||||
}
|
||||
|
||||
c.win_emu.switch_thread = true;
|
||||
c.emu.stop();
|
||||
|
||||
c.win_emu.yield_thread();
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -2444,8 +2442,7 @@ namespace
|
||||
thread->exit_status = exit_status;
|
||||
if (thread == c.proc.active_thread)
|
||||
{
|
||||
c.win_emu.switch_thread = true;
|
||||
c.emu.stop();
|
||||
c.win_emu.yield_thread();
|
||||
}
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
@@ -2464,8 +2461,7 @@ namespace
|
||||
auto& t = c.win_emu.current_thread();
|
||||
t.await_time = convert_delay_interval_to_time_point(delay_interval.read());
|
||||
|
||||
c.win_emu.switch_thread = true;
|
||||
c.emu.stop();
|
||||
c.win_emu.yield_thread();
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
@@ -2508,8 +2504,7 @@ namespace
|
||||
t.await_time = convert_delay_interval_to_time_point(timeout.read());
|
||||
}
|
||||
|
||||
c.win_emu.switch_thread = true;
|
||||
c.emu.stop();
|
||||
c.win_emu.yield_thread();
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -809,6 +809,12 @@ void windows_emulator::setup_process(const emulator_settings& settings)
|
||||
switch_to_thread(*this, main_thread_id);
|
||||
}
|
||||
|
||||
void windows_emulator::yield_thread()
|
||||
{
|
||||
this->switch_thread = true;
|
||||
this->emu().stop();
|
||||
}
|
||||
|
||||
void windows_emulator::perform_thread_switch()
|
||||
{
|
||||
this->switch_thread = false;
|
||||
|
||||
@@ -92,6 +92,7 @@ public:
|
||||
bool fuzzing{false};
|
||||
bool switch_thread{false};
|
||||
|
||||
void yield_thread();
|
||||
void perform_thread_switch();
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user