1.本周工作.PDF

  1. 1、本文档共7页,可阅读全部内容。
  2. 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
1.本周工作

1. 1. C++ concurrency in actionChpater 7. Designing lock-free concurrent data structures 2. 1. SDK 2. Chpater 7. Designing lock-free concurrent data structures Chapter 7. Designing lock-free concurrent data structures 7.1 Definitions and consequences mutex, condition variablefuture blocking unblocking lock-free 7.1.1 Types of nonblocking data structures acquire-releaseatomic_flag 7.1.2 Lock-free data structures compare/exchange loop —— 7.1.3 Wait-free data strucutres wait- free. lock-freewait-free 7.1.4 The pros and cons of lock-free data structures lock_guard, live lock restart wait-free: By definition, wait-free code cant suffer from live lock wait-free non-wait-free 7.2 Examples of lock-free data structures atomic_flag “ Only std::atmoic_flag is guaranteed not to use locks. 7.2.1 Writing a thread-safe stack without locks 1. 2. nextstackhead 3. stackhead 2, 3 1. head 2. head-next 3. head-nexthead 4. data 5. templatetypename class thread_safe_stack { public: struct node; void push(const T data) { auto new_head = new node(data); new_head-_next = head.load(); while (pare_exchange_weak(new_head-_next, new_head)) {} } shared_ptrT pop() { auto old_head = head.load(); while (old_head pare_exchange_weak(old_head, old_head- _next)) {} // old_head-_next might result in undefined behavior if its deleted by other threads return old_head? old_head-_data: shar

文档评论(0)

l215322 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档