Skip to content

Conversation

@slouken
Copy link
Collaborator

@slouken slouken commented Nov 30, 2025

If video is initialized, the main thread is the one that initialized video, otherwise if events are initialized, the main thread is the thread that initialized events, otherwise the main thread is the one that called the main function.

Fixes #14511

@slouken slouken requested a review from icculus November 30, 2025 17:56
@slouken slouken force-pushed the mainthread branch 2 times, most recently from 99c434b to 3f2d09f Compare November 30, 2025 18:27
@icculus
Copy link
Collaborator

icculus commented Nov 30, 2025

I feel like this whole thing has fallen into a "if you want to shoot yourself in the foot, here are the best practices" area. :)

But since almost everything is just going to have a main() function that calls SDL_Init and does video stuff on that thread, if this helps the corner cases that refuse to, I'm cool with it.

@slouken
Copy link
Collaborator Author

slouken commented Nov 30, 2025

I feel like this whole thing has fallen into a "if you want to shoot yourself in the foot, here are the best practices" area. :)

Yeah...

@slouken slouken force-pushed the mainthread branch 2 times, most recently from 609fd38 to c6bc60c Compare November 30, 2025 19:45
If video is initialized, the main thread is the one that initialized video, otherwise if events are initialized, the main thread is the thread that initialized events, otherwise the main thread is the one that called the main function.

Fixes libsdl-org#14511
@slouken slouken merged commit ea1514a into libsdl-org:main Nov 30, 2025
43 checks passed
@slouken slouken deleted the mainthread branch November 30, 2025 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SDL_IsMainThread() behaves inconsistently/incorrectly on some platforms

2 participants