Index

signal/send|init|clear name

Send a signal to a running schedule.

Optional qualifier arguments:
/send (the default)
Send the specified signal.
/init
Discard any previously sent copies of the signal.
/clear
Discard the last sent copy of the signal.
Mandatory arguments:
Signal name
The name of the signal to be sent, initialized or discarded.

Example:
The following example will cause the next call to the signaled(abort) function to return the boolean value, true.
 signal abort

Context:
The signal command provides a way for users of cbiviewer to send a variety of control messages to running schedules. The list of available messages is defined in the cbicontrol startup script by calling the add_signals command. Scheduling scripts either ignore these signals, or periodically check for them by calling the signaled(name) function.

In more detail, there is a counter associated with each signal-name which starts with the value zero, then gets incremented by one whenever the corresponding signal is sent by the user. The $signaled(name) function returns true when this counter is greater than zero. Writers of scheduling scripts should start by zeroing the counters of all the signals that they are interested in. This is done as follows:

 signal/init quit
 signal/init skip
They should then check for the arrival of these signals at appropriate points in the program. For example the following extract of a scheduling script observes jupiter until the user sends a quit signal, then it stows the telescope.
 track jupiter
 until $signaled(quit)
 track stow
If the script writer is expecting to separately respond to the user sending the same signal multiple times, then the writer should use the signal/clear command to decrement the counter of the signal after handling each receipt. Otherwise every call to $signaled(quit) will continue to report on the receipt of the first signal that the user sent.
  foreach(Source s) {jupiter, venus, saturn} {
    track $s
    until $elapsed >= 30m | $signaled(skip)
    if($signaled(skip)) {
      print "Skipping source: ", $s
      signal/clear skip
    }
  }
This example successively observes Jupiter, Venus and Saturn for 30 minutes each unless interrupted by the user typing:
 signal skip
Each time that the user types this, the script stops observing the current source and goes on to observe the next.

Martin Shepherd (3-Mar-1999)