aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_init.c
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2016-01-21 19:53:59 +0100
committerSverker Eriksson <[email protected]>2016-01-21 20:11:04 +0100
commit66a80a7ab735a22249ffbbb7c88eccebba906194 (patch)
tree955314b6651ecbb9be2c43bdbd5037205bb52dc5 /erts/emulator/beam/erl_init.c
parent632eb0ee2fbad692255ca2b1d0c3300fd0b6e492 (diff)
downloadotp-66a80a7ab735a22249ffbbb7c88eccebba906194.tar.gz
otp-66a80a7ab735a22249ffbbb7c88eccebba906194.tar.bz2
otp-66a80a7ab735a22249ffbbb7c88eccebba906194.zip
erts: Add checks for thread safe allocation
Assert thread unsafe allocator is only created on non-smp and only called by the main thread. Removed test of unsafe allocator in custom thread.
Diffstat (limited to 'erts/emulator/beam/erl_init.c')
-rw-r--r--erts/emulator/beam/erl_init.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/erts/emulator/beam/erl_init.c b/erts/emulator/beam/erl_init.c
index 42aca726bf..39957eb58b 100644
--- a/erts/emulator/beam/erl_init.c
+++ b/erts/emulator/beam/erl_init.c
@@ -152,7 +152,7 @@ volatile int erts_writing_erl_crash_dump = 0;
int erts_initialized = 0;
#if defined(USE_THREADS) && !defined(ERTS_SMP)
-static erts_tid_t main_thread;
+erts_tid_t erts_main_thread;
#endif
int erts_use_sender_punish;
@@ -744,6 +744,10 @@ early_init(int *argc, char **argv) /*
char envbuf[21]; /* enough for any 64-bit integer */
size_t envbufsz;
+#if defined(USE_THREADS) && !defined(ERTS_SMP)
+ erts_main_thread = erts_thr_self();
+#endif
+
erts_save_emu_args(*argc, argv);
erts_sched_compact_load = 1;
@@ -797,9 +801,6 @@ early_init(int *argc, char **argv) /*
(erts_aint32_t) ((Uint16) -1));
erts_pre_init_process();
-#if defined(USE_THREADS) && !defined(ERTS_SMP)
- main_thread = erts_thr_self();
-#endif
/*
* We need to know the number of schedulers to use before we
@@ -2285,7 +2286,7 @@ system_cleanup(int flush_async)
if (!flush_async
|| !erts_initialized
#if defined(USE_THREADS) && !defined(ERTS_SMP)
- || !erts_equal_tids(main_thread, erts_thr_self())
+ || !erts_equal_tids(erts_main_thread, erts_thr_self())
#endif
)
return;