aboutsummaryrefslogtreecommitdiffstats
path: root/c_src/nif_helpers.c
diff options
context:
space:
mode:
Diffstat (limited to 'c_src/nif_helpers.c')
-rw-r--r--c_src/nif_helpers.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/c_src/nif_helpers.c b/c_src/nif_helpers.c
index 8953f2e..f29d76d 100644
--- a/c_src/nif_helpers.c
+++ b/c_src/nif_helpers.c
@@ -169,8 +169,9 @@ void* nif_create_main_thread(char* name)
TAILQ_INIT(st->mailbox);
#if defined(__APPLE__) && defined(__MACH__)
- // On OSX, SDL2 must run in the main thread, otherwise some operations
- // will not work properly. For example, input events would not be received.
+ // On OSX we identify ourselves as the main thread to ensure that
+ // we are compatible with libraries that require it. For example
+ // this is necessary with SDL2 in order to receive input events.
erl_drv_steal_main_thread(name, &(st->tid), nif_main_thread, st, NULL);
#else
enif_thread_create(name, &(st->tid), nif_main_thread, st, NULL);