是sig

编程入门 行业动态 更新时间:2024-10-28 04:24:48
本文介绍了是sig_atomic_t和std :: atomic<>可互换的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

按照标题.我可以在信号处理程序中使用std::atomic<>还是sig_atomic_t提供其他编译器功能?

As per the title. Can I use std::atomic<> in a signal handler or does sig_atomic_t provide other compiler features?

推荐答案

n3376 1.9/6

n3376 1.9/6

当抽象机的处理由于接收到信号而中断时,对象的值 都不是

When the processing of the abstract machine is interrupted by receipt of a signal, the values of objects which are neither

-类型为volatile std :: sig_atomic_t或

— of type volatile std::sig_atomic_t nor

—无锁原子对象(29.4)

— lock-free atomic objects (29.4)

,并且不在任何一个中的任何对象的值 处理程序修改的这两个类别将变为未定义.

are unspecified during the execution of the signal handler, and the value of any object not in either of these two categories that is modified by the handler becomes undefined.

无锁29.4/1,2

Lock-free 29.4/1,2

ATOMIC _..._ LOCK_FREE宏指示相应原子类型的无锁属性,其中包括 带符号和不带符号的变体组合在一起.该属性也适用于相应的(部分) 原子模板的专业化.值为0表示这些类型永远不会无锁.值 1表示类型有时是无锁的.值为2表示类型始终是无锁的.

The ATOMIC_..._LOCK_FREE macros indicate the lock-free property of the corresponding atomic types, with the signed and unsigned variants grouped together. The properties also apply to the corresponding (partial) specializations of the atomic template. A value of 0 indicates that the types are never lock-free. A value of 1 indicates that the types are sometimes lock-free. A value of 2 indicates that the types are always lock-free.

函数 atomic_is_lock_free (29.6)指示对象是否无锁.在任何给定程序中 执行时,对于相同类型的所有指针,无锁查询的结果应保持一致.

The function atomic_is_lock_free (29.6) indicates whether the object is lock-free. In any given program execution, the result of the lock-free query shall be consistent for all pointers of the same type.

更多推荐

是sig

本文发布于:2023-10-07 20:04:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1470402.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:sig

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!