Skip to content

ezreal1997/klocker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

klocker

Golang Key Locker: lock by string key, so as to avoid giant lock.

Usage

package main

import (
	"github.com/rayzui/klocker"
)

func() main() {
  mu := &klocker.KMutex{}
  mu.Lock("kmutex")
  // Do something
  mu.Unlock("kmutex")
  
  rwmu := &klocker.RWKMutex{}
  rwmu.RLock("rwkmutex")
  // Get something
  rwmu.RUnlock("rwkmutex")
  rwmu.Lock("rwkmutex")
  // Update something
  rwmu.Unlock("rwkmutex")
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages