[erlang-questions] suspending/resuming a process

Martin Dimitrov mrtndimitrov@REDACTED
Tue Dec 3 14:05:10 CET 2013


Hello,

I am trying to figure out how to use sys:suspend/1,2 and sys:resume/1,2
but without any luck.

I tried:

1> P = spawn(fun() -> lists:foreach(fun(_) -> io:format("cool~n", []),
timer:sleep(1000) end, lists:seq(1, 100)) end).
2> sys:suspend(P).

but the process clearly continued to run because was printing "cool"
every second.

After 5 seconds (which is the default timeout for sys:suspend/1,2, I
guess), I got the following error:

** exception exit: {timeout,{sys,suspend,[<0.176.0>]}}
     in function  sys:send_system_msg/2 (sys.erl, line 242)

Thank you very much,

Martin



More information about the erlang-questions mailing list