Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSX fix joining main thread with calling thread when exiting #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}