[erlang-questions] Letting 'every process run until it is blocked' on an Erlang node.

Jan Henry Nystrom janhenrynystrom@REDACTED
Mon Feb 25 13:30:24 CET 2013


Using tracing with the running flag will let you see when a process was scheduled out and in which function:

erlang:trace(new, true, [running]).
2> spawn(fun() -> receive X -> X end end).
3> flush().
Shell got {trace,<0.33.0>,in,{erlang,apply,2}}
Shell got {trace,<0.33.0>,out,{io,wait_io_mon_reply,2}}
Shell got {trace,<0.33.0>,in,{io,wait_io_mon_reply,2}}
Shell got {trace,<0.34.0>,in,{erlang,apply,2}}
Shell got {trace,<0.34.0>,out,{erl_eval,receive_clauses,6}}

But my hunch is that if you are trying to do this your are doing something fundamentally wrong, but hey without
more information it is hard to tell.

/Cheers Henry

On Feb 25, 2013, at 1:22 PM, Jesper Louis Andersen wrote:

> On Feb 25, 2013, at 11:31 AM, Stavros Aronis <aronisstav@REDACTED> wrote:
>> (Also on Stack Overflow:
>> http://stackoverflow.com/questions/15064887/letting-every-process-run-until-it-is-blocked-on-an-erlang-node
>> )
>> Is it possible to write a function that waits for every process
>> running on an Erlang node to reach a point where it is blocked,
>> waiting for a message?
> I have some code which does so for a set of processes by calling process info for each process as you do. But, I retry until the processes reach a fixpoint in reduction count and status. This is not entirely safe either, but it is better than just looking at the state. And it works for some of my Erlang QuickCheck test cases when considering if they are stable.
> Jesper Louis Andersen
>  Erlang Solutions Ltd., Copenhagen
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

More information about the erlang-questions mailing list