Home > comp > gb.signal 
 fr de es it nl pl pt pt_BR mk sq ca hu cs tr ar fa id vi ko ja ru zh zh_TW eo
Previous  Next  Edit  Rename  Undo  Refresh  Search  Administration  
Documentation
History
 
gb.signal
This component allows to ignore POSIX signals, or intercept them inside an event handler.

Classes
Signal

For more information about signals, see http://en.wikipedia.org/wiki/Signal_(computing).

Signals interrupt processes, but as Gambas is single-threaded, you will receive them from the event loop.

So, if you are using the SLEEP instruction for example, you will never see them.

Example

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.SIGTERM].Catch

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

End