C ++中的锁和互斥锁 [英] Locks and Mutexes in C++

查看:121
本文介绍了C ++中的锁和互斥锁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经学习C ++一段时间了,但仍然没有读过能解释那些野兽是什么的好书?它们是不可或缺的C ++功能吗?如果是这样的话,它们仅在诸如B.S.的The C ++ Programming Language这样的书中被提及.如果没有,您将在哪里获得有关它们的可靠信息-可能是一本书(不太像网络教程),如何定义它们,如何使用它们等. 谢谢您的宝贵帮助.

I have learnt C++ for a while and still didn't come across good book which would explain what are those beasts? Are they integral C++ feature? If so how is it that they are only mentioned in such book like The C++ Programming Language by B.S. If not, where can you get reliable information about them - prefferably a book (don't really like web tutorials), how to define them, how to use them etc. Thank you for any valuable help.

推荐答案

锁和互斥锁是并发构造,用于确保两个线程不会同时访问同一共享数据,从而实现正确性.

Locks and Mutexes are concurrency constructs used to ensure two threads won't access the same shared data at the same time, thus achieving correctness.

当前的C ++标准不具有并发工具.

The current C++ standard doesn't feature concurrency tools.

尽管您提到自己比在线教程更喜欢书籍,但Herb Sutter的

Although you mentioned you prefer books to online tutorials, Herb Sutter's Effective Concurrency column is definitely a must read.

还有Anthony Williams即将出版的书,名为 C ++在行动中并发.安东尼·威廉姆斯(Anthony Williams)是 Boost.Thread 的作者.库.

There is also Anthony Williams's upcoming book called C++ Concurrency in Action. Anthony Williams is the author of the Boost.Thread library.

另一个值得一看的线程库是 Intel的TBB .

Another threading library worth a look is Intel's TBB.

这篇关于C ++中的锁和互斥锁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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