Skip to content

Commit ab43811

Browse files
remove old os_sleep() hack for Mac (#6894)
SDL 1.2 had an issue using SDL_Delay() on Mac where it caused bad stuttering and freezes. A hack was added to avoid this, but it causes 100% CPU usage when it should be a sleep state, so it wasn't ideal. With SDL 2 this issue was resolved with the underlying code being unified for all *NIX variants and that problematic Mac-specific code was removed. So now we can remove the hack to offer a little better performance on Macs.
1 parent dce9e1c commit ab43811

File tree

1 file changed

+0
-9
lines changed

1 file changed

+0
-9
lines changed

code/osapi/osapi.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -451,16 +451,7 @@ bool os_foreground()
451451
// Sleeps for n milliseconds or until app becomes active.
452452
void os_sleep(uint ms)
453453
{
454-
#ifdef __APPLE__
455-
// ewwww, I hate this!! SDL_Delay() is causing issues for us though and this
456-
// basically matches Apple examples of the same thing. Same as SDL_Delay() but
457-
// we aren't hitting up the system for anything during the process
458-
uint then = SDL_GetTicks() + ms;
459-
460-
while (then > SDL_GetTicks());
461-
#else
462454
SDL_Delay(ms);
463-
#endif
464455
}
465456

466457
static bool file_exists(const SCP_string& path) {

0 commit comments

Comments
 (0)