lockmap

package
v0.5.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2024 License: MIT Imports: 1 Imported by: 2

Documentation

Overview

lockmap is a sharded lock map.

The API is as if LockMap consisted of a lock for every possible uint64 (which we think of as "addresses", but they could be any abstract location); LockMap.Acquire(a) acquires the lock associated with a and LockMap.Release(a) release it.

The implementation doesn't actually maintain all of these locks; it instead maintains a fixed collection of shards so that shard i is responsible for maintaining the lock state of all a such that a % NSHARDS = i. Acquiring a lock requires synchronizing with any threads accessing the same shard.

Index

Constants

View Source
const NSHARD uint64 = 65537

Variables

This section is empty.

Functions

This section is empty.

Types

type LockMap

type LockMap struct {
	// contains filtered or unexported fields
}

func MkLockMap

func MkLockMap() *LockMap

func (*LockMap) Acquire

func (lmap *LockMap) Acquire(flataddr uint64)

func (*LockMap) Release

func (lmap *LockMap) Release(flataddr uint64)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL