[erlang-questions] suspending/resuming a process

Dmitry Klionsky <>
Tue Dec 3 14:13:38 CET 2013


The sys module doesn't work with any processes, but only with those 
implemented using behaviours or the special processes implemented using 
proc_lib.
http://www.erlang.org/doc/design_principles/spec_proc.html


On 12/03/2013 04:05 PM, Martin Dimitrov wrote:
> 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
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions


-- 
Best regards,
Dmitry Klionsky




More information about the erlang-questions mailing list