SDL3Lifecycle Class
Owns the SDL3 process-level lifetime.
- Microsoft.Extensions.Hosting.IHostedService.StartAsync(System.Threading.CancellationToken) calls SDL_Init before any SDL-dependent service is resolved.
- System.IDisposable.Dispose calls SDL_Quit during DI LIFO teardown, after all SDL-dependent
singletons have been disposed.
SDL_Quit intentionally lives in Brine2D.Rendering.SDL3Lifecycle.Dispose, not Microsoft.Extensions.Hosting.IHostedService.StopAsync(System.Threading.CancellationToken),
because StopAsync runs before DI disposal — calling it there would pull the rug from under
services like AudioService that release SDL resources in their own System.IDisposable.Dispose.
internal sealed class SDL3Lifecycle : Microsoft.Extensions.Hosting.IHostedService, System.IDisposable
Inheritance System.Object → SDL3Lifecycle
Implements Microsoft.Extensions.Hosting.IHostedService, System.IDisposable
| Constructors | |
|---|---|
| SDL3Lifecycle(ILogger<SDL3Lifecycle>) | Owns the SDL3 process-level lifetime. ...SDL_Quit intentionally lives in Brine2D.Rendering.SDL3Lifecycle.Dispose, not Microsoft.Extensions.Hosting.IHostedService.StopAsync(System.Threading.CancellationToken), because StopAsync runs before DI disposal — calling it there would pull the rug from under services like AudioService that release SDL resources in their own System.IDisposable.Dispose. |