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. UOJ #266 【清华集训2016】 Alice和Bob又在玩游戏

    题目链接:Alice和Bob又在玩游戏 这道题就是一个很显然的公平游戏. 首先\(O(n^2)\)的算法非常好写.暴力枚举每个后继计算\(mex\)即可.注意计算后继的时候可以直接从父亲转移过来,没必 ...

  2. [原][译][osgearth]Model Source Drivers模型驱动源(OE官方文档翻译)

    ModelSource 是一个能生成OpenSceneGraph节点的驱动(driver) osgEarth使用ModelSources显示矢量特征(feature)数据和加载和显示外部3d模型 Fe ...

  3. HttpClient将手机上的数据发送到服务器

    到官网下载jar包,下载GA发布版本即可 在项目中将httpclient-4.5.5.jar.httpcore-4.4.9.jar.httpmime-4.5.5.jar.commons-logging ...

  4. notepad++个人专注

    notepad++个人专注   快捷键 功能 1 Ctrl>>>>>>>>>>    Ctrl + b  匹配括号 Ctrl + d  选中 ...

  5. 配置java环境变量,实现一条命令自由切java7 或java8

    在多个java编译环境中,有时需要java 7,有时又需要java 8,怎么配置java 环境,可以快速自动切换呢?下面用mac演示在 /etc/bashrc 中配置的环境变量 # 设置 JDK ex ...

  6. Robot Framework中使用HttpLibrary教程and中文支持

    Robot Framework中使用and转参数时,默认不支持中文模式,如图场景: 会出现这种错误 FAIL : UnicodeDecodeError: 'ascii' codec can't dec ...

  7. Maven的安装学习笔记

    安装 1.下载安装包:http://maven.apache.org/download.cgi 2.检查JDK是否安装,没有安装,先安装JDK cmd中输入:java -version 3.解压后配置 ...

  8. Linux解压rar、zip、war、tar文件

    在Linux上解压常见文件的命令: rar文件:rar e xxx.rar zip文件:unzip -xzvf xxx.zip war包:jar -xvf xxx.war tar包:tar -xzvf ...

  9. Yii在window下的安装方法

    首先,在http://www.yiichina.com/上下载yii 然后,配置系统环境变量,在win8下,按win+x,找到系统->高级系统设置->环境变量->path 把php的 ...

  10. Java中String.valueOf()方法的解释

    1. 由 基本数据型态转换成 String String 类别中已经提供了将基本数据型态转换成 String 的 static 方法 也就是 String.valueOf() 这个参数多载的方法 有下 ...