便携式比较和交换(原子操作),C / C ++库? [英] Portable Compare And Swap (atomic operations) C/C++ library?

查看:162
本文介绍了便携式比较和交换(原子操作),C / C ++库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有小型图书馆,即wrapps各种处理器的CAS般的业务并入宏或功能,即可以跨多个编译器?

Is there any small library, that wrapps various processors' CAS-like operations into macros or functions, that are portable across multiple compilers?

PS。借助 atomic.hpp库里面的boost ::进程间::详细的命名空间。笔者拒绝让它公开,维护良好的图书馆。

PS. The atomic.hpp library is inside boost::interprocess::detail namespace. The author refuses to make it a public, well maintained library.

让我们重新讨论这个问题,并看看是否有任何其他选项?

推荐答案

英特尔线程构建模块有一个很好的便携原子与LT ; T> 模板,你想要做什么。但无论是一个小型图书馆与否当然可以争论。

Intel Threading Building Blocks has a nice portable atomic<T> template which does what you want. But whether it is a small library or not can of course be debated..

这篇关于便携式比较和交换(原子操作),C / C ++库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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