shad-go/keylock/README.md
2020-03-14 15:11:46 +03:00

17 lines
No EOL
567 B
Markdown

# keylock
Напишите примитив синхронизации, позволяющий "лочить" строки из множества.
```go
package keylock
type KeyLock interface {
// LockKeys locks all keys from provided set.
//
// Upon successful completion, function guarantees that no other call with intersecting set of keys
// will finish, until unlock() is called.
//
// If cancel channel is closed, function returns immediately.
LockKeys(keys []string, cancel <-chan struct{}) (canceled bool, unlock func())
}
```