GitXplorerGitXplorer
y

keylock

public
18 stars
9 forks
1 issues

Commits

List of commits on branch master.
Unverified
0bff96d0bae2b71b933d19a95dac783266e524bc

Update link to CI pipeline

yyarspirin committed 5 years ago
Unverified
bb527e9b8c3f8dbd77bd22363bc155566cd0dc0d

Update README.md

yyarspirin committed 5 years ago
Unverified
ceead98556523809d58064c28f63ed2a0f862904

Update interface

yyarspirin committed 5 years ago
Unverified
72bdc45927f7bf48624a8c30d54361f038d0a876

Merge branch 'master' of https://github.com/mountain-viewer/keyl0ck

yyarspirin committed 5 years ago
Unverified
c7e397d9b85b3ca9cdeedf939647f911f3918ab6

Add build status

yyarspirin committed 5 years ago
Verified
a0fc835123d588b12be3a0beab02297163305524

Merge pull request #1 from mountain-viewer/ci

yyarspirin committed 5 years ago

README

The README file for this repository.

keylock

Build Status

A Golang utility package which provides a way to lock a set of keys so that any subsequent call with a non-empty subset of already locked keys makes the goroutine waiting.

Usage

l := keylock.New()

canceled, unlock := l.LockKeys([]string{"a", "b"}, nil)  // locks {"a", "b"}
defer unlock()

go func() {
    _, _ = l.LockKeys([]string{"b", "c"}, nil)  // can't lock {"b", "c"} 
}()                                             // since "b" has been locked already

time.Sleep(time.Millisecond * 10)
canceled, _ = l.LockKeys([]string{"d"}, nil)  // locks {"d"}