#include <thread>
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
void pool_executor()
{
return;
}
class nn_thread
{
std::thread *threads;
public:
nn_thread(int thread_ct)
{
threads = (std::thread *)malloc(sizeof(std::thread) * thread_ct);
threads[1] = std::thread(pool_executor);
}
~nn_thread()
{
threads[1].join();
free(threads);
}
};
int main(int argc, char *argv[])
{
nn_thread model_threads(4);
return 0;
}
As soon as i add this graphic library SDL2, my program starts throwing Segmentation fault. Can someone explain me the reason?
I tried searching if SDL2 has some restrictions for multi-threading or something but i didn't find any.