Skip to content

Commit

Permalink
OSX fix joining main tread with calling thread
Browse files Browse the repository at this point in the history
This is from ninenines#11
  • Loading branch information
brainstormi authored and Serneum committed Sep 13, 2016
1 parent 163c6f8 commit cb4a211
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions c_src/nif_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,14 @@ void nif_destroy_main_thread(void* void_st)
nif_thread_message* msg = nif_thread_message_alloc(NULL, NULL, NULL);

nif_thread_send(st, msg);
enif_thread_join(st->tid, NULL);
#if defined(__APPLE__) && defined(__MACH__)
erl_drv_stolen_main_thread_join(st->tid, NULL);
#else
enif_thread_join(st->tid, NULL);
#endif

enif_cond_destroy(st->cond);
enif_mutex_destroy(st->lock);
enif_cond_destroy(st->cond);
enif_free(st->mailbox);
enif_free(st);
}

0 comments on commit cb4a211

Please sign in to comment.