[erlang-questions] How can process_info return a status of exiting?

Austin Haas austin@REDACTED
Mon Jan 30 19:32:42 CET 2012


I've been studying the beam source code to learn about how processes
are implemented and I've run into a dead end on this minor detail.

How can process_info return a status of exiting for a target process?

It appears that process_info_2 ignores exiting processes entirely.

If I am following the source code correctly, process_info_2 gets a
reference (rp) to the target process by calling pi_pid2proc, which in
turn calls erts_pid2proc. erts_pid2proc is defined as
erts_pid2proc_opt with a 0 for the optional flags, which means that it
does not supply the ERTS_P2P_FLG_ALLOW_OTHER_X flag, which means that
a process that is currently exiting will never be returned via these
calls. If pi_pid2proc does not return a reference, then process_info_2
returns undefined and the code that looks up the status of the process
will never execute.

I probably either took a wrong turn tracing the code (perhaps due to
various #ifdefS) or I'm overlooking some nuance of how processes are
implemented. I'd really appreciate any pointers, tips, or wisdom.

-austin

-- 
Austin Haas
Pet Tomato, Inc.
http://pettomato.com





More information about the erlang-questions mailing list