Commit ac0f1195 authored by deuce's avatar deuce
Browse files

Init SDL before starting any threads on Darwin

parent 780fb767
......@@ -1881,8 +1881,6 @@ CIOLIBEXPORT enum ciolib_codepage CIOLIBCALL ciolib_getcodepage(void)
#undef main
#endif
sem_t initsdl_sem;
sem_t initsdldone_sem;
sem_t startsdl_sem;
sem_t main_sem;
int initsdl_ret = -1;
......@@ -1900,7 +1898,6 @@ void main_stub(void *argptr)
struct main_args *args = (struct main_args *)argptr;
args->ret = CIOLIB_main(args->argc, args->argv);
args->no_sdl = 1;
sem_post(&initsdl_sem);
sem_post(&startsdl_sem);
sem_post(&main_sem);
exit_sdl_con();
......@@ -1909,15 +1906,11 @@ void main_stub(void *argptr)
int main(int argc, char **argv)
{
struct main_args ma = {argc, argv, -1, 0};
sem_init(&initsdl_sem, 0, 0);
sem_init(&initsdldone_sem, 0, 0);
sem_init(&startsdl_sem, 0, 0);
sem_init(&main_sem, 0, 0);
initsdl_ret = init_sdl_video();
_beginthread(main_stub, 0, &ma);
sem_wait(&initsdl_sem);
if (!ma.no_sdl) {
initsdl_ret = init_sdl_video();
sem_post(&initsdldone_sem);
if (initsdl_ret != -1) {
sem_wait(&startsdl_sem);
sdl_video_event_thread(NULL);
......
......@@ -559,10 +559,8 @@ CIOLIBEXPORT void CIOLIBCALL ansi_ciolib_setdoorway(int enable);
#endif
#if defined(__DARWIN__)
extern sem_t initsdl_sem;
extern sem_t main_sem;
extern sem_t startsdl_sem;
extern sem_t initsdldone_sem;
extern int initsdl_ret;
#endif
#endif
......
......@@ -1057,8 +1057,6 @@ void sdl_video_event_thread(void *data)
int sdl_initciolib(int mode)
{
#if defined(__DARWIN__)
sem_post(&initsdl_sem);
sem_wait(&initsdldone_sem);
if (initsdl_ret) {
#else
if(init_sdl_video()) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment