aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_alloc_util.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_alloc_util.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_alloc_util.c')
-rw-r--r--erts/emulator/beam/erl_alloc_util.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/erts/emulator/beam/erl_alloc_util.c b/erts/emulator/beam/erl_alloc_util.c
index eedfd1e13d..3230b6ef34 100644
--- a/erts/emulator/beam/erl_alloc_util.c
+++ b/erts/emulator/beam/erl_alloc_util.c
@@ -5337,6 +5337,11 @@ do_erts_alcu_alloc(ErtsAlcType_t type, void *extra, Uint size)
void *erts_alcu_alloc(ErtsAlcType_t type, void *extra, Uint size)
{
void *res;
+#ifdef ERTS_SMP
+ ASSERT(!"This is not thread safe");
+#elif defined(USE_THREADS)
+ ASSERT(erts_equal_tids(erts_main_thread, erts_thr_self()));
+#endif
res = do_erts_alcu_alloc(type, extra, size);
DEBUG_CHECK_ALIGNMENT(res);
return res;