mirror of
https://github.com/godotengine/godot.git
synced 2024-11-26 22:23:04 +00:00
Merge pull request #18541 from profan/fix/win-sleep
Windows: ensure minimum possible timer resolution for sleep
This commit is contained in:
commit
a53b08861a
@ -188,6 +188,10 @@ void OS_Windows::initialize_core() {
|
||||
ticks_start = 0;
|
||||
ticks_start = get_ticks_usec();
|
||||
|
||||
// set minimum resolution for periodic timers, otherwise Sleep(n) may wait at least as
|
||||
// long as the windows scheduler resolution (~16-30ms) even for calls like Sleep(1)
|
||||
timeBeginPeriod(1);
|
||||
|
||||
process_map = memnew((Map<ProcessID, ProcessInfo>));
|
||||
|
||||
IP_Unix::make_default();
|
||||
@ -1252,6 +1256,8 @@ void OS_Windows::finalize() {
|
||||
|
||||
void OS_Windows::finalize_core() {
|
||||
|
||||
timeEndPeriod(1);
|
||||
|
||||
memdelete(process_map);
|
||||
|
||||
TCPServerWinsock::cleanup();
|
||||
|
Loading…
Reference in New Issue
Block a user