Skip to content

An efficient key-based multiple mutex library for Go, designed to improve locking performance by preventing a giant time-consuming locking.

License

Notifications You must be signed in to change notification settings

wanliqun/kmutex-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kmutex-go

kmutex-go is an efficient key-based multiple mutex library for Go, designed to improve locking performance by preventing a giant time-consuming locking. This library is ideal for scenarios where you need to lock based on a specific key, avoiding contention on a single mutex.

Features

  • Key-based locking to reduce contention
  • Efficient memory usage with sync.Pool
  • Easy-to-use API

Installation

go get github.com/wanliqun/kmutex-go

Usage

package main

import (
    "fmt"
    "github.com/wanliqun/kmutex-go"
)

func main() {
    key := "example_key"
    kmutex.Lock(key)
    // Perform your operations here
    fmt.Println("Locked by key:", key)
    kmutex.Unlock(key)
    fmt.Println("Unlocked by key:", key)
}

Also Check

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

An efficient key-based multiple mutex library for Go, designed to improve locking performance by preventing a giant time-consuming locking.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages