SafetyFast

 

Put thread-safety first, with the performance of safety last.

Example SafetyFast Atomic usage

This is a Go library that implements synchronization primitives over Intel TSX (Intel’s hardware transactional primitives). The library exposes interfaces to make use of Intel HLE and Intel RTM.

Usage Patterns

go get github.com/linux4life798/safetyfast

RTM Context

package main

import "github.com/linux4life798/safetyfast"

func main() {
    r := safetyfast.NewRTMContexDefault()
    r.Atomic(func() {
        btc.Touch(index) // Any action
    })
}

HLE Spin Lock

package main

import (
    "sync"
    "github.com/linux4life798/safetyfast"
)

func main() {
    var m sync.Locker = new(safetyfast.SpinHLEMutex)
    m.Lock()
    btc.Touch(index) // Any action
    m.Unlock()
}

Poster

Download PDF

A preview of the PDF should appear below. If it does not show up soon, please refresh the page.

Previous