zoukankan      html  css  js  c++  java
  • 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.

  • 相关阅读:
    数据库相关(转)
    sql之left join、right join、inner join的区别
    PHP面试编程
    实验6 shell程序设计一(1)
    实验7 shell程序设计二(1)
    Linux软件安装管理
    Linux常用命令总结
    合唱团
    linux课后作业1
    linux网络服务实验
  • 原文地址:https://www.cnblogs.com/lenmom/p/9359382.html
Copyright © 2011-2022 走看看