gb.signal

该组件允许您忽略POSIX信号,或在事件处理程序中截获它们。

作者 Benoît Minisini.

说明
Signal 这个类允许管理 POSIX 信号。

有关信号的更多信息, 参见 http://en.wikipedia.org/wiki/Signal_(computing).

信号会中断进程, 但由于Gambas是单线程的, 您将从事件循环中收到它们。

所以,如果你在例子中使用 SLEEP 指令, 你永远也见不到上述情况发生。

Examples

Public Sub Application_Signal(Signal As Integer)

  Print "Don't do that: I don't want to die during my sleep!"

End

Public Sub Main()

  ' Ignore the signal sent when you hit CTRL+Z in a terminal
  Signal[Signal.SIGTSTP].Ignore

  ' Catch the signal sent when you hit CTRL+C in a terminal
  Signal[Signal.SIGINT].Catch

  ' Sleep one hour :-) But do not use the Sleep instruction, otherwise you won't see the signal!
  Wait(3600)

End