Hello, I´m currently experimenting with threads and I wrote this simple window loop to test it.
void Window::thread_windowloop()
{
static bool wa = true;
while (wa)
{
SDL_Event e;
while (SDL_PollEvent(&e) != 0)
{
if (e.type == SDL_QUIT)
{
wa = false;
}
}
SDL_RenderClear(renderer);
SDL_RenderPresent(renderer);
}
}
When I call this function normally, everything works, but when I call this function with a std::thread, the window freezes. Is there a solution or is it not possible to run this with a thread?