CancellationToken.Register() vs Task.WhenAny for timeout-driven cleanup in async operations
Goal Implement timeout-driven cancellation for an async operation that acquires and releases a limited resource (e.g., database connection, file handle). The timeout must trigger cleanup even if the operation ignores its cancellation token. Constraint The cleanup action must execute deterministically at timeout, but registered callbacks via CancellationToken