SmallLocks
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的更多相关文章
- 一个无锁消息队列引发的血案(五)——RingQueue(中) 休眠的艺术
目录 (一)起因 (二)混合自旋锁 (三)q3.h 与 RingBuffer (四)RingQueue(上) 自旋锁 (五)RingQueue(中) 休眠的艺术 (六)RingQueue(中) 休眠的 ...
- folly学习心得(转)
原文地址: https://www.cnblogs.com/Leo_wl/archive/2012/06/27/2566346.html 阅读目录 学习代码库的一般步骤 folly库的学习心得 ...
- 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 ...
随机推荐
- 这是一份很详细的 Retrofit 2.0 使用教程(含实例讲解)
前言 在Andrroid开发中,网络请求十分常用 而在Android网络请求库中,Retrofit是当下最热的一个网络请求库 今天,我将献上一份非常详细Retrofit v2.0的使用教程,希望你们会 ...
- 关联规则&Apriori算法
2017-12-02 14:27:18 一.术语 Items:项,简记I Transaction:所有项的一个非空子集,简记T Dataset:Transaction的一个集合,简记D 关联规则: 一 ...
- Spring学习10- bean的生命周期(阿里面试题目两次面试均提到)
找工作的时候有些人会被问道Spring中Bean的生命周期,其实也就是考察一下对Spring是否熟悉,工作中很少用到其中的内容,那我们简单看一下. 在说明前可以思考一下Servlet的生命周期:实例化 ...
- VAE--就是AutoEncoder的编码输出服从正态分布
花式解释AutoEncoder与VAE 什么是自动编码器 自动编码器(AutoEncoder)最开始作为一种数据的压缩方法,其特点有: 1)跟数据相关程度很高,这意味着自动编码器只能压缩与训练数据相似 ...
- python学习笔记(六)---sublime text3 创建python项目
1.创建项目 依次鼠标左键点击Project>Add Folder to Project...,选择test文件夹: 2.保存项目 依次鼠标左键点击Project>Save Project ...
- POJ 3984 迷宫问题 bfs 难度:0
http://poj.org/problem?id=3984 典型的迷宫问题,记录最快到达某个点的是哪个点即可 #include <cstdio> #include <cstring ...
- 如何处理HTML5新标签的兼容性问题
支持HTML5新标签: * IE8/IE7/IE6支持通过document.createElement方法产生的标签, 可以利用这一特性让这些浏览器支持HTML5新标签, 浏览器支持新标签后,还需要添 ...
- js enter键激发事件
document.onkeydown = function (e) { if (!e) e = window.event; if ((e.keyCode | ...
- gulp-css-spriter 将css代码中的切片图片合并成雪碧图
NPM地址:https://www.npmjs.com/package/gulp-css-spriter/ 配置gulpfile.js: var gulp = require('gulp'), ...
- myeclipse单步调试
如何进行myclipse的单步调式与跟踪?希望大虾们详细点,多谢. 打断点,然后运行,进debug试图,按F6执行一行,按F5是钻进去执行 追问 朋友,能详细点吗? 本人是初学 回答 如图 如若成功请 ...