SDL_Init from separate threads and events


In my application I’m creating multiple threads where each of them runs SDL_Init(SDL_INIT_VIDEO) ,
SDL_PollEvent , drawing with opengl etc, and it’s working.

My problem is that that the SDL_PollEvent doesn’t bring me the relevant events of the current thread, but, for example, I can get mouse motion events from a window that was iniated from another thread.

I’ve seen the warning This should only be run in the thread that initialized the video subsystem about SDL_PumpEvents, but since indeed I’ve initialized the video subsystem in the same thread that I’m polling for events I thought that would be ok/solved.

Some more specific context:

I’m developing a VST3 plugin, where there is host application gives me a hwnd on which I call SDL_CreateWindowFrom.
My application is loaded as a dynamic library and, depending always on the host, it’s typical that several open instances of my plugin will share anything static - ie running on the same process.
So, as I mentioned, in every open instance of my plugin I create a thread to initialize SDL and draw.