mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-19 03:33:56 +00:00
Support stopping emulation while all threads are sleeping
This fixes #242
This commit is contained in:
@@ -606,11 +606,13 @@ void windows_emulator::setup_hooks()
|
||||
|
||||
void windows_emulator::start(size_t count)
|
||||
{
|
||||
this->should_stop = false;
|
||||
|
||||
const auto use_count = count > 0;
|
||||
const auto start_instructions = this->executed_instructions_;
|
||||
const auto target_instructions = start_instructions + count;
|
||||
|
||||
while (true)
|
||||
while (!this->should_stop)
|
||||
{
|
||||
if (this->switch_thread_ || !this->current_thread().is_thread_ready(this->process, this->clock()))
|
||||
{
|
||||
@@ -638,6 +640,12 @@ void windows_emulator::start(size_t count)
|
||||
}
|
||||
}
|
||||
|
||||
void windows_emulator::stop()
|
||||
{
|
||||
this->should_stop = true;
|
||||
this->emu().stop();
|
||||
}
|
||||
|
||||
void windows_emulator::register_factories(utils::buffer_deserializer& buffer)
|
||||
{
|
||||
buffer.register_factory<memory_manager_wrapper>([this] {
|
||||
|
||||
Reference in New Issue
Block a user