本文介绍了暂停/暂停整个Erlang程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种简单的方法来暂停/暂停整个Erlang程序,而无需使用OS命令(例如Windows的sysinternals pssuspend)?



理想情况下,我想

解决方案

我认为我的问题的简短答案是不 p>

您可以向所有进程发送暂停消息。然而,如果使用大量流程,则很难知道流程将停止在什么顺序中,并且如果使用大量流程,则可能会有相对较大的时间延迟。最后我确实使用pssuspend来执行此操作:



在Erlang中:

  runmyscript() - > 
接收
updatemodel->
os:cmd(start myscript.bat),
...
end。

在myscript.bat中

  pssuspend werl.exe 
mycommands
...
pssuspend -r werl.exe
exit
/ pre>

Is there a simple way to suspend/pause an entire Erlang program without resorting to using OS commands (e.g. sysinternals pssuspend for Windows)?

Ideally I would like to resume the program on return from an external program.

解决方案

I think the short answer to my question is 'no'.

You can send a pause message to all processes. However it is difficult to know in what order processes will stop and there could be a relatively large time delay if a lot of processes are used. In the end I did use pssuspend to do this:

In Erlang:

runmyscript() ->
  receive
       updatemodel->
           os:cmd("start myscript.bat"),
...
end.

In myscript.bat

pssuspend werl.exe
mycommands
...
pssuspend -r werl.exe
exit

这篇关于暂停/暂停整个Erlang程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 17:09