aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2016-05-20 17:19:40 +0200
committerSverker Eriksson <[email protected]>2016-06-27 17:11:25 +0200
commitdfb64c6be9363a0f0f16bc0eb37da11ec4ec10fa (patch)
tree5b8327e864c85a445d342ae65c5599c96d498611
parent3b7a6ffddc819bf305353a593904cea9e932e7dc (diff)
downloadotp-dfb64c6be9363a0f0f16bc0eb37da11ec4ec10fa.tar.gz
otp-dfb64c6be9363a0f0f16bc0eb37da11ec4ec10fa.tar.bz2
otp-dfb64c6be9363a0f0f16bc0eb37da11ec4ec10fa.zip
erts: Improve system_info(dist_ctrl)
to not block multi threading. Do the same as erlang:nodes/1, just grab dist table read lock.
-rw-r--r--erts/emulator/beam/erl_bif_info.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/erts/emulator/beam/erl_bif_info.c b/erts/emulator/beam/erl_bif_info.c
index 3fb866733c..6cedf3c8a5 100644
--- a/erts/emulator/beam/erl_bif_info.c
+++ b/erts/emulator/beam/erl_bif_info.c
@@ -2284,9 +2284,7 @@ BIF_RETTYPE system_info_1(BIF_ALIST_1)
} else if (ERTS_IS_ATOM_STR("dist_ctrl", BIF_ARG_1)) {
DistEntry *dep;
i = 0;
- /* Need to be the only thread running... */
- erts_smp_proc_unlock(BIF_P, ERTS_PROC_LOCK_MAIN);
- erts_smp_thr_progress_block();
+ erts_smp_rwmtx_rlock(&erts_dist_table_rwmtx);
for (dep = erts_visible_dist_entries; dep; dep = dep->next)
++i;
for (dep = erts_hidden_dist_entries; dep; dep = dep->next)
@@ -2309,8 +2307,7 @@ BIF_RETTYPE system_info_1(BIF_ALIST_1)
res = CONS(hp, tpl, res);
hp += 2;
}
- erts_smp_thr_progress_unblock();
- erts_smp_proc_lock(BIF_P, ERTS_PROC_LOCK_MAIN);
+ erts_smp_rwmtx_runlock(&erts_dist_table_rwmtx);
BIF_RET(res);
} else if (BIF_ARG_1 == am_system_version) {
erts_dsprintf_buf_t *dsbufp = erts_create_tmp_dsbuf(0);