No description
This repository has been archived on 2024年06月28日 . You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
| clock.go | feat: initial commit | |
| errors.go | feat: initial commit | |
| go.mod | feat: initial commit | |
| go.sum | feat: initial commit | |
| LICENSE | feat: initial commit | |
| lock.go | feat: initial commit | |
| README.md | feat: initial commit | |
| tl2.go | refactor: remove unnecessary return value | |
| tl2_test.go | refactor: remove unnecessary return value | |
Software Transactional Memory
This implementation is based on the paper: Transactional Locking II - D Dice.
cnt:=stm.NewTVar(0)new,err:=stm.Atomically(func(tx*stm.Tx)(any,error){old,err:=cnt.Load(tx)iferr!=nil{returnnil,err}new:=old.(int)+1cnt.Store(tx,new)returnnew,nil})See tl2_test.go for more examples.