The following is two programs. The first, send_sigqueue, demonstrates sending a realtime signal with the sigqueue system call. The program takes three arguments: the target process's PID, the signal number (which should be between SIGRTMIN (34) and SIGRTMAX (64)), and the integer data value to send with the signal.
The second program, catch_sigqueue, establishes a handler for realtime signal number 39 (SIGRTMIN + 5), and enters an infinite loop. The start of the loop body blocks this signal; the loop then suspends the process's execution for a few seconds; at the bottom of the loop, the process unblocks the signal. The purpose of blocking and unblocking the signal is to demonstrate that the kernel queues realtime signals: if we send N realtime signals while the loop body is sleeping, the kernel will deliver the N signals when the process unblocks that signal.
The complete source code for the two programs and Makefile to build them is available as a zip file.