OSX fix joining main thread with calling thread when exiting
Current commit fixes a segfault when terminating the app in OSX. Continue to be issues with dtor_Texture that generates a different segfault in current demos, so to be able to replicate the segfault fixed by this commit, limit the code to create a window and exit. On OSX we have to use erl_drv_steal_main_thread, a not documented function to run SDL2 in main thread. In the same way, to join it again with the calling thread when exiting, we have to invoke erl_drv_stolen_main_thread_join instead of enif_thread_join like in Windows/Linux.
I totally missed that. Nice find. Will see if I can try it tomorrow.
I don't think I will have time today. I will get back to you. Thanks!
Added a new PR #12 that should fix all the remaing seg faults in OSX/Windows environments, discussed in issue #2