[SDL] SDL_CreateRGBSurface in second thread?

mediata mediata at abv.bg
Wed Sep 14 00:42:27 PDT 2016


I have progress about this question i create simple program to test this case
here is thread function:

Code:

static void
load_texture()
{
    SDL_Surface *surface = nullptr;
    
    std::cout << "THREAD STARTED!\n";
    while (true)
    {
        surface = IMG_Load("images/wheel/background.png");
        if (surface == nullptr)
        {
            std::cout << "ERROR LOADNING SURFACE!!!\n";
            
        }
        SDL_FreeSurface(surface);
        usleep(5000);
    }
    std::cout << "THREAD END!\n";
}




And i have no problem with drawing and loading for past 10 minutes




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20160914/3b1a7a9e/attachment.htm>


More information about the SDL mailing list