1 Star 0 Fork 0

hxz / mcas

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

MCAS is a Common Lisp Multiple CAS library on CAR/CDR of ref-cells. An N-way MCAS, without contention, needs only N+1 CAS instructions.

This library was ported from the mcas file in David McClain's Lisp-Actors library, https://github.com/dbmcclain/Lisp-Actors/blob/main/data-objects/mcas-v4.lisp

API

The APIs are quite simple, only expert mcas-ref, make-mcas-ref, mcas, and mcas-val.

mcas-ref

A structure which is designed for mcas.

make-mcas-ref (init-value)

Create an mcas-ref instance which can be mcased, the values will be compared by eq.

mcas (&rest triples)

Return T if mcas succeeded, or NIl if it failed. TRIPLES: a sequence of (ref old new) as would be suitable for CAS. But each ref must be a total-order MCAS-REF.

mcas-val

Get the current value of an mcas-ref.

Usage

The basis usage of mcas is very like that of normal cas, except mcas' arguments are triples.

(let* ((a  (make-mcas-ref 15))
       (b  (make-mcas-ref 16)))
  (mcas  a 15 32
         b 16 33)
  (list (mcas-val a) (mcas-val b)))

Limitation

The limitation of this library is that the mcas-places are restricted to mcas-ref structure. And the normal cas-places can be car of a list, slot of a struct, svref of a simple-array, etc, although they depend on the CL implementation.

Potability

The vanilla mcas can be used only in Lispworks, this mcas library depends on Shinmera's atomics library, which decides the potability of this library. https://github.com/Shinmera/atomics

Licence

The vanilla Lisp-Actors is shared with licence "Unlicense License". This licence claims that anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

Version

The version of this library will keep up with that of Lisp-Actors.

空文件

简介

Common Lisp Multiple CAS on CAR/CDR of ref-cells. An N-way MCAS, without contention, needs only N+1 CAS instructions. 展开 收起
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Common Lisp
1
https://gitee.com/hxz/mcas.git
git@gitee.com:hxz/mcas.git
hxz
mcas
mcas
master

搜索帮助