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. window 常用指令

    1. window 快捷键 Win+D: / 点击右下角右下角 返回到桌面Win+E: 打开“资源管理器” / 调出磁盘窗口Win+L: 锁定当前用户. / 锁屏Win+R: 打开“运行”对话框.Wi ...

  2. vue之双绑实现

    // html <body> <div id="app"> <input type="text" v-model="nu ...

  3. Rails-treasure chest4: 使用图表对资料进行分析chart.js(及其他);管理用户权限的gem 'Pumdit'(6000🌟)

    * 多档案上传* 图表资料分析  Chartkick gem或者 chart.js* 用户权限控管  gem Pundit (6000✨) *HTML E-mail 寄送 : gem premaile ...

  4. tomcat 容器下web项目由http改为https操作步骤及相关的坑

    一.https介绍:    HTTPS(全称:Hypertext Transfer Protocol over Secure Socket Layer),是以安全为目标的HTTP通道,简单讲是HTTP ...

  5. Git分支管理及合并

    Git分支管理   建立分支 git branch [name]   切换到分支 git checkout [name]   查看有哪些分支 git branch   比较分支 git diff [b ...

  6. C#金额千分位分隔

    "234234".ToString("C") 显示:¥234,234

  7. Mysql04

    mysql: dbs 数据库系统 bdms 数据库管理系统 bda 数据库管理员 db 数据库 dba通过dbms来操作db! 关系型数据库和非关系型数据库 登录mysql mysql -h主机地址 ...

  8. easyui combotree 异步树 前端写法js

    简要说下使用场景: combotree下拉框第一次加载时,请求一个接口,页面上展示顶层节点们(可以理解为最顶层的节点,比如所有的一级公司): 当点击其中一个节点前面的小三角展开时,再次请求服务器接口( ...

  9. vue.js 源代码学习笔记 ----- text-parse.js

    /* @flow */ import { cached } from 'shared/util' import { parseFilters } from './filter-parser' //找到 ...

  10. CI框架的引导流程以及基准测试类

    一[CI]框架的引导流程了解一下,并掌握如何新增自己的扩展类库   http://www.cnblogs.com/ohmygirl/p/CIRead-4.html // CI框架源码阅读笔记4 引导文 ...