Timers are a required platform feature

Many SDL subsystems depend on being able to see time passing. If you are porting to a new platform, you'll need to fill in a timer implementation as part of the initial port.

Fixes https://github.com/libsdl-org/SDL/issues/8850
This commit is contained in:
Sam Lantinga
2024-01-16 20:09:37 -08:00
parent 518b070aa9
commit 0d7df16812
7 changed files with 2 additions and 75 deletions

View File

@@ -48,9 +48,7 @@
#include "sensor/SDL_sensor_c.h"
/* Initialization/Cleanup routines */
#ifndef SDL_TIMERS_DISABLED
#include "timer/SDL_timer_c.h"
#endif
#ifdef SDL_VIDEO_DRIVER_WINDOWS
extern int SDL_HelperWindowCreate(void);
extern int SDL_HelperWindowDestroy(void);
@@ -202,9 +200,7 @@ int SDL_InitSubSystem(Uint32 flags)
}
#endif
#ifndef SDL_TIMERS_DISABLED
SDL_InitTicks();
#endif
/* Initialize the event subsystem */
if (flags & SDL_INIT_EVENTS) {
@@ -227,7 +223,6 @@ int SDL_InitSubSystem(Uint32 flags)
/* Initialize the timer subsystem */
if (flags & SDL_INIT_TIMER) {
#if !defined(SDL_TIMERS_DISABLED) && !defined(SDL_TIMER_DUMMY)
if (SDL_ShouldInitSubsystem(SDL_INIT_TIMER)) {
SDL_IncrementSubsystemRefCount(SDL_INIT_TIMER);
if (SDL_InitTimers() < 0) {
@@ -238,10 +233,6 @@ int SDL_InitSubSystem(Uint32 flags)
SDL_IncrementSubsystemRefCount(SDL_INIT_TIMER);
}
flags_initialized |= SDL_INIT_TIMER;
#else
SDL_SetError("SDL not built with timer support");
goto quit_and_error;
#endif
}
/* Initialize the video subsystem */
@@ -454,14 +445,12 @@ void SDL_QuitSubSystem(Uint32 flags)
}
#endif
#if !defined(SDL_TIMERS_DISABLED) && !defined(SDL_TIMER_DUMMY)
if (flags & SDL_INIT_TIMER) {
if (SDL_ShouldQuitSubsystem(SDL_INIT_TIMER)) {
SDL_QuitTimers();
}
SDL_DecrementSubsystemRefCount(SDL_INIT_TIMER);
}
#endif
#ifndef SDL_EVENTS_DISABLED
if (flags & SDL_INIT_EVENTS) {
@@ -513,9 +502,7 @@ void SDL_Quit(void)
#endif
SDL_QuitSubSystem(SDL_INIT_EVERYTHING);
#ifndef SDL_TIMERS_DISABLED
SDL_QuitTicks();
#endif
#ifdef SDL_USE_LIBDBUS
SDL_DBus_Quit();