I have an SDL2 c++ program that generates an SDL_window, while also employing a socket server that receives data through recv. I noticed that whenever recv is blocking and expecting data, the SDL window actions like window motion with a mouse, or minimizing and closing the window by clicking the corner buttons are disabled. Of course I expect the program functions to be frozen while recv is blocking, but I am surprized about window motion being frozen as well, since I would expect that this would be handled in parallel by the OS. Is there anything I can do to retain SDL_window motion while recv blocks?
EDIT:
In terms of code, the window is created by a call to
gWindow = SDL_CreateWindow("Program", 0, 55, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN | SDL_WINDOW_ALWAYS_ON_TOP);
within the SDL initialization call. The program runs in loops, and there is an SDL event handler
SDL_Event e;
which is used to catch e.g. a click to close the window
while (SDL_PollEvent(&e) != 0)
{
//User requests quit
if (e.type == SDL_QUIT)
{
quit = true;
}
}
I guess it makes sense that this functionality is disabled while recv is blocking. I just wonder if there is an extra layer one can add to let the OS take over this task, which would not yet be in my code at all.