summaryrefslogtreecommitdiff
path: root/erts/emulator/beam/register.c
diff options
context:
space:
mode:
authorPatrik Nyblom <pan@erlang.org>2010-05-31 16:59:30 +0200
committerPatrik Nyblom <pan@erlang.org>2010-06-01 12:28:13 +0200
commit3d783a44dc3d13830766cacf3c315c13558d69bb (patch)
tree0051b20457caead6ee1d50c8a471901aaced2b3b /erts/emulator/beam/register.c
parent256fb889b337781d27642471f16a5c7e0a988d8c (diff)
downloaderlang-3d783a44dc3d13830766cacf3c315c13558d69bb.tar.gz
Keep process lock over trace of unregister
Diffstat (limited to 'erts/emulator/beam/register.c')
-rw-r--r--erts/emulator/beam/register.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/erts/emulator/beam/register.c b/erts/emulator/beam/register.c
index 964c10a380..1da8f768e7 100644
--- a/erts/emulator/beam/register.c
+++ b/erts/emulator/beam/register.c
@@ -489,9 +489,9 @@ int erts_unregister_name(Process *c_p,
if (is_non_value(name)) {
/* Unregister current process name */
ASSERT(c_p);
- if (c_p->reg)
+ if (c_p->reg) {
r.name = c_p->reg->name;
- else {
+ } else {
/* Name got unregistered while main lock was released */
res = 0;
goto done;
@@ -534,6 +534,7 @@ int erts_unregister_name(Process *c_p,
} else if (rp->p) {
Process* p = rp->p;
+
#ifdef ERTS_SMP
erts_proc_safelock(c_p,
current_c_p_locks,
@@ -544,13 +545,13 @@ int erts_unregister_name(Process *c_p,
current_c_p_locks = c_p_locks;
#endif
p->reg = NULL;
+ if (IS_TRACED_FL(p, F_TRACE_PROCS)) {
+ trace_proc(c_p, p, am_unregister, r.name);
+ }
#ifdef ERTS_SMP
if (rp->p != c_p)
erts_smp_proc_unlock(rp->p, ERTS_PROC_LOCK_MAIN);
#endif
- if (IS_TRACED_FL(p, F_TRACE_PROCS)) {
- trace_proc(c_p, p, am_unregister, r.name);
- }
}
hash_erase(&process_reg, (void*) &r);
res = 1;