This is an appendix to
Programming written for people interested in Ada programming on POSIX
You can find the short translation program as rotate.adb.
Compile the program, and run it using the default settings:
<- is backspace)
% gnatmake -P rotate % ./rotate abx<-cd bcde efgCtrl-C %
The second example here should be run from
another low-tech shell.
The version which just does the job: play_again0.adb
The version which gives immediate response: play_again1.adb
The version which ignores illegal keys: play_again2.adb
The version which ignores illegal keys: play_again3.adb
Since signal handling using function
thread unsafe, this isn't a part of POSIX/Ada. For the
sake of completing the examples in this chapter, I have created a binding
to these unsafe functions in
package C_Signals. Once we have
covered how to write parallel programs, we will take a look at the proper,
thead-safe methods in
You can find the first simple signal handling program here: sigdemo1.adb
You can find the second simple signal handling program here: sigdemo2.adb
Notice that these two programs use
package C_Signals which
only works for single-threaded (non-parallel) programs.
The version which catches signals, resets the driver, and returns a negative result: play_again4.adb
Go to next chapter.
Understanding Unix/Linux Programming, Bruce Molay, ISBN 0-13-008396-8.