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 Chris Rees committed Aug 30, 2016
1 parent b3f697a commit 4189b49
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 4189b49

Please sign in to comment.