Incoming messages to your process can come in the form of a signal. Signals are standard message packets that the operating system will use to tell your process something about the environment.
This snippet will show you show to setup a signal handler in your program.