aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--c_src/nif_helpers.c4
-rw-r--r--c_src/nif_helpers.h8
2 files changed, 10 insertions, 2 deletions
diff --git a/c_src/nif_helpers.c b/c_src/nif_helpers.c
index 0f98cd6..8953f2e 100644
--- a/c_src/nif_helpers.c
+++ b/c_src/nif_helpers.c
@@ -163,8 +163,8 @@ void* nif_create_main_thread(char* name)
{
nif_thread_state* st = (nif_thread_state*)enif_alloc(sizeof(nif_thread_state));
- st->lock = enif_mutex_create("esdl2_lock");
- st->cond = enif_cond_create("esdl2_cond");
+ st->lock = enif_mutex_create("nif_thread_mailbox_lock");
+ st->cond = enif_cond_create("nif_thread_mailbox_cond");
st->mailbox = (nif_thread_mailbox*)enif_alloc(sizeof(nif_thread_mailbox));
TAILQ_INIT(st->mailbox);
diff --git a/c_src/nif_helpers.h b/c_src/nif_helpers.h
index 111ea84..2eefec6 100644
--- a/c_src/nif_helpers.h
+++ b/c_src/nif_helpers.h
@@ -120,11 +120,19 @@
typedef void* nif_thread_arg;
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void* nif_create_main_thread(char*);
void nif_destroy_main_thread(void*);
ERL_NIF_TERM nif_thread_cast(ErlNifEnv*, void (*f)(nif_thread_arg*), int a, ...);
ERL_NIF_TERM nif_thread_call(ErlNifEnv*, ERL_NIF_TERM (*f)(ErlNifEnv*, nif_thread_arg*), int a, ...);
+#ifdef __cplusplus
+}
+#endif
+
#define NIF_CAST_HANDLER(f) static void f(nif_thread_arg* args)
#define NIF_CALL_HANDLER(f) static ERL_NIF_TERM f(ErlNifEnv* env, nif_thread_arg* args)