Erlang Linux信号处理 [英] Erlang Linux signal handling
问题描述
是否可以通过Erlang中的处理程序来捕获Linux信号(例如SIGUSR1)? (无需诉诸C中制作的司机)
Is it possible to trap Linux signals (e.g. SIGUSR1) through an handler in Erlang? (without having to resort to a driver crafted in C)
推荐答案
(不是一个真正的答案)
(NOT A REAL ANSWER)
2001年有人问:
有没有人可以在erlang中有unix
信号处理的例子。我会
喜欢做一个负担平衡器,我
已经写了响应叹息。
Does anyone have any examples of unix signal handling in erlang. I would like to make a loadbalancer that I have written respond to sighup.
那时候答案是:
在Erlang本身中没有处理
信号的条款,即
将需要使用驱动程序 - 或者
端口程序当然可能实际上是一个
更好的主意。另外对于司机案例,
仿真器有一个
数量的信号的自己的处理程序,并且干扰
可能会有
有趣的结果 - 但是SIGHUP
应该可以,我相信。
There is no provision for handling signals in Erlang "itself", i.e. you will need to use a driver - or a port program of course, might actually be a better idea. Also for the driver case, the emulator has its own handler for a number of signals, and interfering with that will probably have "interesting" results - but SIGHUP should be OK I believe.
资料来源: http://www.erlang.org/pipermail/erlang-questions/2001-October/003752.html
据我所知,从那以后没有变化。但这是非常有趣的。如果有人有任何消息,请告诉我们:)
As far as I know, nothing changed since then. But this is extremely interesting. If anyone has any news about this, please let us know :)
这篇关于Erlang Linux信号处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!