aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_process_lock.h
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2012-02-27 18:45:47 +0100
committerRickard Green <[email protected]>2012-04-27 12:41:57 +0200
commit4bcffe41e193bfa03f54f77e2158b3d989a001d0 (patch)
tree322a8c6f5f7de2458b0fbd274cb5356a76689519 /erts/emulator/beam/erl_process_lock.h
parent414f4fb8dc9a188f8148a1f92e5f9125108e170d (diff)
downloadotp-4bcffe41e193bfa03f54f77e2158b3d989a001d0.tar.gz
otp-4bcffe41e193bfa03f54f77e2158b3d989a001d0.tar.bz2
otp-4bcffe41e193bfa03f54f77e2158b3d989a001d0.zip
Optimize process state changes
Diffstat (limited to 'erts/emulator/beam/erl_process_lock.h')
-rw-r--r--erts/emulator/beam/erl_process_lock.h25
1 files changed, 11 insertions, 14 deletions
diff --git a/erts/emulator/beam/erl_process_lock.h b/erts/emulator/beam/erl_process_lock.h
index 9981af7a8a..015fda583e 100644
--- a/erts/emulator/beam/erl_process_lock.h
+++ b/erts/emulator/beam/erl_process_lock.h
@@ -129,11 +129,9 @@ typedef struct erts_proc_lock_t_ {
/*
* Status lock:
* Protects the following fields in the process structure:
- * * status
- * * rstatus
- * * status_flags
* * pending_suspenders
* * suspendee
+ * * ...
*/
#define ERTS_PROC_LOCK_STATUS (((ErtsProcLocks) 1) << ERTS_PROC_LOCK_MAX_BIT)
@@ -165,12 +163,11 @@ typedef struct erts_proc_lock_t_ {
* Other rules regarding process locking:
*
* Exiting processes:
- * When changing status to P_EXITING on a process, you are required
- * to take all process locks (ERTS_PROC_LOCKS_ALL). Thus, by holding
- * at least one process lock (whichever one doesn't matter) you
- * are guaranteed that the process won't exit until the lock you are
- * holding has been released. Appart from all process locks also
- * the pix lock corresponding to the process has to be held.
+ * When changing state to exiting (ERTS_PSFLG_EXITING) on a process,
+ * you are required to take all process locks (ERTS_PROC_LOCKS_ALL).
+ * Thus, by holding at least one process lock (whichever one doesn't
+ * matter) you are guaranteed that the process won't exit until the
+ * lock you are holding has been released.
*
* Lock order:
* Process locks with low numeric values has to be locked before
@@ -946,11 +943,11 @@ erts_pid2proc_opt(Process *c_p_unused,
int flags)
{
Process *proc = erts_proc_lookup_raw(pid);
- if (!(flags & ERTS_P2P_FLG_ALLOW_OTHER_X)
- && proc
- && proc->status == P_EXITING)
- return NULL;
- return proc;
+ return ((!(flags & ERTS_P2P_FLG_ALLOW_OTHER_X)
+ && proc
+ && ERTS_PROC_IS_EXITING(proc))
+ ? NULL
+ : proc);
}
#endif /* !ERTS_SMP */