Revert "Revert "(iOS) Don't use iteration timers anymore""

This reverts commit df0307348d.
This commit is contained in:
Twinaphex 2015-08-06 08:38:11 +02:00
parent df0307348d
commit 109dc850d0

View File

@ -37,7 +37,6 @@
static id apple_platform;
static CFRunLoopObserverRef iterate_observer;
static CFRunLoopTimerRef iterate_timer;
/* forward declaration */
void apple_rarch_exited(void);
@ -63,14 +62,6 @@ static void rarch_draw(void)
rarch_main_data_iterate();
if (iterate_timer)
{
if (rarch_main_data_active())
CFRunLoopAddTimer(CFRunLoopGetMain(), iterate_timer, kCFRunLoopCommonModes);
else
CFRunLoopRemoveTimer(CFRunLoopGetMain(), iterate_timer, kCFRunLoopCommonModes);
}
if (ret == -1)
{
main_exit_save_config();
@ -309,23 +300,9 @@ void apple_start_iterate_observer(void)
CFRunLoopAddObserver(CFRunLoopGetMain(), iterate_observer, kCFRunLoopCommonModes);
}
void apple_start_iterate_timer(void)
{
CFTimeInterval interval;
if (iterate_timer)
return;
// This number is a double measured in seconds.
interval = 1.0 / 60.0 / 1000.0;
iterate_timer = CFRunLoopTimerCreate(0, interval, interval, 0, 0, rarch_draw_timer, 0);
}
- (void) apple_start_iteration
{
apple_start_iterate_observer();
apple_start_iterate_timer();
}
void apple_stop_iterate_observer(void)
@ -338,20 +315,9 @@ void apple_stop_iterate_observer(void)
iterate_observer = NULL;
}
void apple_stop_iterate_timer(void)
{
if (!iterate_timer)
return;
CFRunLoopTimerInvalidate(iterate_timer);
CFRelease(iterate_timer);
iterate_timer = NULL;
}
- (void) apple_stop_iteration
{
apple_stop_iterate_observer();
apple_stop_iterate_timer();
}
- (void)applicationDidEnterBackground:(UIApplication *)application