21 Signal Handling
This chapter describes the problems that can occur when UNIX signals are mixed with X applications. It explains how
signals work, and why they can wreak havoc with X. The chapter also suggests some workarounds that can help an
application to minimize the damage. Since the technology is not well thought−through in this area and signals are a
fact of life for UNIX applications, something must be done. The techniques described here can be thought of as a
practical starting point until the problems are addressed by UNIX and X system developers at a more fundamental
level.
When writing an X−based application, programmers sometimes run into one of the most frustrating stumbling blocks
of development: how to handle UNIX signals appropriately for an X client application. The problem is difficult to
identify because there are rarely any adverse effects to the improper handling of signals. When problems do arise, the
unwitting developer may spend weeks trying to unravel the mystery. Symptoms include spurious X protocol errors,
lost X events, incomplete window redraws, or even core dumps. These problems arise because many people fail to
understand the relationship between UNIX signals and the X protocol design.
To make an analogy for the type of behavior associated with UNIX signals, let's examine a telephone feature most of
us are familiar with: call waiting. We start with a situation where you're on the phone talking to someone while
someone else is trying to call you. When you have ...