Skip to content

Lockset provides dynamic mutexes based on lock keys in Golang.

License

Notifications You must be signed in to change notification settings

optimus-hft/lockset

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lockset

pipeline codecov Go Report Card Go Reference

GoLang Dynamic Mutexes

Lockset provides dynamic mutexes based on lock keys. Each key is locked and unlocked separately and does not affect other keys. Instead of protecting everything with a giant mutex, Different parts of code can be protected by a tiny mutex in isolation to provide more throughput and concurrency.

Getting Started

Installation

go get github.com/optimus-hft/lockset

Usage

package cmd

import lockset "github.com/optimus-hft/lockset"

func main() {
	s := lockset.New()

	s.Lock("lock1")
	defer s.Unlock("lock1")

	locked := s.TryLock("lock2")
	if locked {
		defer s.Unlock("lock2")
	}
}

Contributing

Pull requests and bug reports are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

This project is licensed under the MIT License.

About

Lockset provides dynamic mutexes based on lock keys in Golang.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages