File tree Expand file tree Collapse file tree 3 files changed +9
-1
lines changed
Expand file tree Collapse file tree 3 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -280,6 +280,11 @@ bool SDL_IsMainThread(void)
280280 return true;
281281}
282282
283+ bool SDL_IsVideoThread (void )
284+ {
285+ return (SDL_GetCurrentThreadID () == SDL_VideoThreadID );
286+ }
287+
283288// Initialize all the subsystems that require initialization before threads start
284289void SDL_InitMainThread (void )
285290{
Original file line number Diff line number Diff line change @@ -307,6 +307,9 @@ extern SDL_NORETURN void SDL_ExitProcess(int exitcode);
307307// Do any initialization that needs to happen before threads are started
308308extern void SDL_InitMainThread (void );
309309
310+ // Return true if this thread has initialized video
311+ extern bool SDL_IsVideoThread (void );
312+
310313/* The internal implementations of these functions have up to nanosecond precision.
311314 We can expose these functions as part of the API if we want to later.
312315*/
Original file line number Diff line number Diff line change @@ -388,7 +388,7 @@ static void HIDAPI_UpdateDiscovery(void)
388388 }
389389
390390#if defined(SDL_PLATFORM_WIN32 ) || defined(SDL_PLATFORM_WINGDK )
391- if (SDL_IsMainThread ()) {
391+ if (SDL_IsVideoThread ()) {
392392 // just let the usual SDL_PumpEvents loop dispatch these, fixing bug 2998. --ryan.
393393 } else {
394394 // We'll only get messages on the same thread that created the window
You can’t perform that action at this time.
0 commit comments