`
hongtoushizi
  • 浏览: 356813 次
  • 性别: Icon_minigender_1
  • 来自: 天津
社区版块
存档分类
最新评论

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亦通常被用来告知应用程序重载配置文件;例如,向Apache HTTP服务器发送一个USR1信号将导致以下步骤的发生:停止接受新的连接,等待当前连接停止,重新载入配置文件,重新打开日志文件,重启服务器,从而实现相对平滑的不关机的更改。

 

 

摘自: http://pauillac.inria.fr/~xleroy/linuxthreads/faq.html#H.4

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics