Uncertain death
Ulf Wiger (AL/EAB)
ulf.wiger@REDACTED
Sun Nov 20 15:45:14 CET 2005
I agree. /Uffe
________________________________
From: Robert Virding [mailto:robert.virding@REDACTED]
Sent: den 19 november 2005 18:21
To: Ulf Wiger (AL/EAB)
Cc: Dominic Williams; erlang-questions@REDACTED
Subject: Re: Uncertain death
Doing exit(Pid, kill) sends an exit signal, of value kill, to
the process so it should be scheduled in the same way as "normal" exit
signals. Generally I think you should be careful if you start special
casing various things as you can get unexpected behavious.
Robert
Ulf Wiger (AL/EAB) wrote:
When you send an exit signal to a process,
it is scheduled in order to receive it.
This goes for 'kill' messages as well, even
though you'd think that they could be
killed right away by the runtime system.
/Uffe
-----Original Message-----
From: owner-erlang-questions@REDACTED
[mailto:owner-erlang-questions@REDACTED] On
Behalf Of
Dominic Williams
Sent: den 17 november 2005 23:32
To: 'erlang-questions@REDACTED'
Subject: Uncertain death
Hello,
The following program seems to me to indicate
that when a
processes gets killed, there is, for a brief
moment,
contradictory information about its state.
Specifically, the
information returned by processes() seems to lag
behind that
given by is_process_alive().
%%% death.erl
-module (death).
-export ([run/0, server/0]).
run() ->
Pid = spawn (?MODULE, server, []),
exit (Pid, kill),
report (Pid),
timer:sleep(1000),
report (Pid).
report (Pid) ->
io:fwrite("~p alive: ~p; member of
processes(): ~p~n",
[Pid, is_process_alive (Pid),
lists:member(Pid,
processes())]).
server () ->
receive
hello ->
server();
stop ->
bye
end.
%%% end death.erl
1> c("/Users/dodo/tmp/death", [{outdir,
"/Users/dodo/tmp/"}]).
{ok,death}
2> death:run().
<0.35.0> alive: false; member of processes():
true <0.35.0>
alive: false; member of processes(): false ok
Same result under MacOS/R9C and WinXP/R10B
Regards,
Dominic Williams
http://www.dominicwilliams.net
----
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20051120/d5e4d9a3/attachment.htm>
More information about the erlang-questions
mailing list