mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-18 16:30:29 +00:00
Pulls the call to .update out of the critical section.
This commit is contained in:
parent
3f57020b00
commit
9666193c67
@ -628,11 +628,14 @@ int main(int argc, char *argv[]) {
|
|||||||
bool should_quit = false;
|
bool should_quit = false;
|
||||||
Uint32 fullscreen_mode = 0;
|
Uint32 fullscreen_mode = 0;
|
||||||
while(!should_quit) {
|
while(!should_quit) {
|
||||||
// Wait for vsync and draw a new frame (NB: machine_mutex is *not* currently locked).
|
// Wait for vsync, draw a new frame and post a machine update.
|
||||||
|
// NB: machine_mutex is *not* currently locked, therefore it shouldn't
|
||||||
|
// be 'most' of the time.
|
||||||
SDL_GL_SwapWindow(window);
|
SDL_GL_SwapWindow(window);
|
||||||
scan_target.update(int(window_width), int(window_height));
|
scan_target.update(int(window_width), int(window_height));
|
||||||
scan_target.draw(int(window_width), int(window_height));
|
scan_target.draw(int(window_width), int(window_height));
|
||||||
if(activity_observer) activity_observer->draw();
|
if(activity_observer) activity_observer->draw();
|
||||||
|
updater.update();
|
||||||
|
|
||||||
// Grab the machine lock and process all pending events.
|
// Grab the machine lock and process all pending events.
|
||||||
std::lock_guard<std::mutex> lock_guard(machine_mutex);
|
std::lock_guard<std::mutex> lock_guard(machine_mutex);
|
||||||
@ -854,9 +857,6 @@ int main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Request a machine update.
|
|
||||||
updater.update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean up.
|
// Clean up.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user