Tag

signal

2 posts

Code

SIGR: Yet Another Simple SIGnal manageR

Signal plays an important role in communication with POSIX system.

For example, what if our code been killed, interrupted, hung on? Generally, the operation system (I am talking about BSD, Unix-like, POSIX system, same in the follow but will omitted), will not really "KILL" it, it will just send a kill signal with id to this process, the this process will process this signal later.

Here is a table to describe the id to default action.

Code

Scala 怎样添加事件, 获得打断信号

启动 Scala 工程, 我们有时候可能需要做这样的处理: 获取打断(Interrupt )信号, 在程序关闭前做最后一些操作.

在 C 中, 我们一般可以用 signal 来实现, 而在 scala 中,我们同样有类似的机制.