CS 355 - Systems Programming:
Unix/Linux with C

Video game programming

Reference: Molay, Understanding Unix/Linux Programming, Chapter 7.7-7.12

Signal handling using signal()

signal() is unreliable when multiple signals arrive at short succession. Possibilities:

Signal handling using sigaction()

int sigaction(int signum, const struct sigaction *action, struct sigaction *prevaction);

Critical sections

Data can get corrupted when multiple signals arrive and attempt to modify the same data structure. A section of code is called a critical section if interruptions to that section can result in incomplete or damaged data. A critical section should block signals with sigprocmask() and sigsetops(). A signal handler or any function that can be called when it is already active and not cause any problems is said to be reentrant.

Signals and timers in a video game