I can no longer use the signals SIGUSR1 and SIGUSR2 in my programs! Why?

(1):

H.4: With LinuxThreads, I can no longer use the signals SIGUSR1 and SIGUSR2 in my programs! Why?

The short answer is: because the Linux kernel you're using does not support realtime signals.

LinuxThreads needs two signals for its internal operation. One is used to suspend and restart threads blocked on mutex, condition or semaphore operations. The other is used for thread cancellation.

On ``old'' kernels (2.0 and early 2.1 kernels), there are only 32 signals available and the kernel reserves all of them but two: SIGUSR1 and SIGUSR2. So, LinuxThreads has no choice but use those two signals.

On recent kernels (2.2 and up), more than 32 signals are provided in the form of realtime signals. When run on one of those kernels, LinuxThreads uses two reserved realtime signals for its internal operation, thus leaving SIGUSR1 and SIGUSR2 free for user code. (This works only with glibc, not with libc 5.)

 

(2)

 

USR1 is also commonly used to tell the application to reload the configuration file; for example, sending a USR1 signal to the Apache HTTP server will cause the following steps to occur: stop accepting new connections, wait for the current connection to stop, reload the configuration file, reopen log files, restart the server, and thus achieve relatively smooth changes without shutdown.

 

 

Taken from:  http://pauillac.inria.fr/~xleroy/linuxthreads/faq.html#H.4

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327061948&siteId=291194637