[erlang-patches] Re: process_info(P,current_function) and HiPE (was Re: Bugs with hibernate/3 and HiPE)

Björn Gustavsson bgustavsson@REDACTED
Thu Sep 30 14:14:52 CEST 2010


On Tue, Sep 28, 2010 at 3:27 PM, Mikael Pettersson <mikpe@REDACTED> wrote:
> b) when you're allowed to call process_info(P, current_function) on
> a BEAM-mode function and what it returns; what if the target process
> is currently running? does it stop or does process_info then return
> stale data

process_info(P, current_function) will not return stale data. It will
wait (in an efficient way) for the target process to stop running
before it reads out the current function. So the current function
returned will always be the function that was current the last time
the target process was scheduled out.

Basically, current_function must be up-to-date when scheduling
out the process or when process_info(self(), current_function)
is called. BEAM calls process_info/{1,2} through apply_bif to
make sure that c_p->current_function is up-to-date.

-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB


More information about the erlang-patches mailing list