Signaling – caveats and gotchas

Signals, being asynchronous events, can cause errors and bugs in subtle ways that are not immediately apparent to the casual reviewer (or programmer, for that matter). Some kinds of functionality or behavior are directly or indirectly affected by the arrival of one or more signal; you need to be alert to possible subtle races and similar conditions.

One important area in this that we have already covered is as follows: inside a signal handler, you can only invoke functions that are documented as being (or have been designed to be) async-signal safe. Other areas too deserve some contemplation; read on.

Get Hands-On System Programming with Linux now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.