folly/SmallLocks.h

This module is currently x64 only.

This header defines two very small mutex types. These are useful in highly memory-constrained environments where contention is unlikely. The purpose of these is to allow fine-grained locking in massive data structures where memory is at a premium. Often, each record may have a spare bit or byte lying around, so sometimes these can be tacked on with no additional memory cost.

There are two types exported from this header. MicroSpinLock is a single byte lock, and PicoSpinLock can be wrapped around an integer to use a single bit as a lock. Why do we have both? Because you can't use x64 bts on a single byte, sosizeof(MicroSpinLock) is smaller than sizeof(PicoSpinLock) can be, giving it some use cases.

Both the locks in this header model the C++11 Lockable concept. So you can use std::lock_guard or std::unique_lock to lock them in an RAII way if you want.

Additional information is in the header.

SmallLocks的更多相关文章

  1. 一个无锁消息队列引发的血案(五)——RingQueue(中) 休眠的艺术

    目录 (一)起因 (二)混合自旋锁 (三)q3.h 与 RingBuffer (四)RingQueue(上) 自旋锁 (五)RingQueue(中) 休眠的艺术 (六)RingQueue(中) 休眠的 ...

  2. folly学习心得(转)

    原文地址:  https://www.cnblogs.com/Leo_wl/archive/2012/06/27/2566346.html   阅读目录 学习代码库的一般步骤 folly库的学习心得 ...

  3. Folly: Facebook Open-source Library Readme.md 和 Overview.md(感觉包含的东西并不多,还是Boost更有用)

    folly/ For a high level overview see the README Components Below is a list of (some) Folly component ...

随机推荐

  1. 使用 Rcpp

    正如我们所提到的那样,并行计算只有在每次迭代都是独立的情况下才可行,这样最终结果才不会依赖运行顺序.然而,并非所有任务都像这样理想.因此,并行计算可能会受到影响.那么怎样才能使算法快速运行,并且可以轻 ...

  2. 日志_测试代码_Delphi7

    1. 2.Delphi (Windows API 文件尾部添加) function LogFile(_str :string) :integer; var hFile :THandle; strFil ...

  3. AI病毒来袭,拿什么拯救你我的电脑?

    文|雷宇 来源|智能相对论(aixdlun) 在刘慈欣的科幻小说<中国2185>中,除领土,领海,领空外,还有一个被称为电子领土的地方,这个地方除了容易受常规武器破坏外,还容易受到软件武器 ...

  4. Ant是什么

    Ant是什么? 一.总结 一句话总结: 编译 打包 测试 工具 xml Ant是Java的生成工具,是Apache的核心项目: Ant类似于Unix中的Make工具,都是用来编译.生成: Ant是跨平 ...

  5. 10046event vs 10053event做了哪些操作

    10046 event 告诉我们oracle做了哪些事情,做的怎么样.10053 event 告诉我们oracle优化器怎么想的,再给出成本最低的最终的优化方案,考虑了哪些执行计划拿了哪些统计信息

  6. ES6学习一 JS语言增强篇

    一 背景 JavaScript经过二十来年年的发展,由最初简单的交互脚本语言,发展到今天的富客户端交互,后端服务器处理,跨平台(Native),以及小程序等等的应用.JS的角色越来越重要,处理场景越来 ...

  7. Java中的HashMap的工作原理是什么?

    问答题23 /120 Java中的HashMap的工作原理是什么? 参考答案 Java中的HashMap是以键值对(key-value)的形式存储元素的.HashMap需要一个hash函数,它使用ha ...

  8. C#读写三菱Fx PLC 使用Fx 串口协议 读写Fx3U设备

    本文将使用一个Github开源的组件库技术来读写三菱 FX PLC,使用的是基于串口的实现,不需要额外的组件,读取操作只要放到后台线程就不会卡死线程,本组件支持超级方便的高性能读写操作 github地 ...

  9. c#TextBox输入框自动提示、自动完成、自动补全功能

    功能概览 相关属性 TextBox.AutoCompleteCustomSource 属性 获取或设置当 TextBox.AutoCompleteSource 属性设置为 [CustomSource] ...

  10. 中国的 Python 量化交易工具链有哪些

    摘抄自知乎:https://www.zhihu.com/question/28557233 如题,提问的范围限于适合中国大陆金融市场使用的工具链,所以IbPy和Quotopian之类主要面向欧美市场的 ...