admin管理员组文章数量:1357392
There is a limited number of functions that POSIX defines as async-signal safe
.
See here.
This includes some fundamental functions such as write
.
Since this is really a C
standard (since unix is built on C) that makes no mention of C++, I would expect this to be undefined, but the question is: can I use any c++ functions or classes (which involve constructors/destructors etc) inside a signal handler? For example: can I construct a std::string
or std::pair
?
malloc
is not on the list of async-signal safe functions, so it is probably safe to assume that the potential memory allocation used by std::string makes it async-signal unsafe in the general sense (?).
本文标签: linuxasyncsignal safety of c classesStack Overflow
版权声明:本文标题:linux - async-signal safety of c++ classes - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743989567a2571885.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论