port to sdl 2, TODO: exit for threads