It is possible for device servers to receive signals from drivers or other processes even while in the main wait loop. The DSM supports signals via a single unified call ds__signal(). This call has the same syntax on all operating systems (even OS9) and has been modelled on the Posix call signal().
ds__signal has the following syntax -
long ds__signal (int signo, void (*action)(), long *error);This call is used to register a function action for the signal signo. As soon as the device server receives a signal, it checks to see whether an action has been registered under this signal number and then calls it. Only one action can be registered per signal.
Signals allow the device server to set up asynchronous actions (e.g. timers) during execution of a command and return control to the client. On receipt of the signal (at a later time) the device server can then take appropriate action.
ds__signal() is the only to register actions with signals for device servers. This is because the device server has to exit gracefully and is always programmed for the signal SIGTERM. On receipt of the signal SIGTERM the device server will first check to see whether the class has registered its interest for this signal. If so it will call the corresponding function. After that it will exit gracefully by unregistering the device server from the static database.
For more information see the manual page ds__signal.