在调用信号处理标准库函数 [英] Calling a standard library function in signal handler

查看:74
本文介绍了在调用信号处理标准库函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么调用标准库函数内部信号处理程序气馁?

Why is calling a standard library function inside a signal handler discouraged?

推荐答案

这是在的 GNU库文档

如果你调用处理程序函数,请确保它是可重入相对于信号,否则请确保信号不能中断调用出相关的功能。

If you call a function in the handler, make sure it is reentrant with respect to signals, or else make sure that the signal cannot interrupt a call to a related function.

和公正的情况下,这里的一对折返功能维基百科页面

And just in case, here's the Wikipedia page on reentrant functions.

一个计算机程序或程序被描述为可重入,如果它可以安全地再次的previous调用之前调用已经完成(即它可以安全地并行执行)。

A computer program or routine is described as reentrant if it can be safely called again before its previous invocation has been completed (i.e it can be safely executed concurrently).

这篇关于在调用信号处理标准库函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆