mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Documentation/learning/lock/client: Add defer Unlock (#11802)
This commit is contained in:
parent
51de68ddac
commit
9006d8d4f9
@ -183,6 +183,7 @@ func main() {
|
||||
|
||||
locker := concurrency.NewLocker(session, "/lock")
|
||||
locker.Lock()
|
||||
defer locker.Unlock()
|
||||
version := session.Lease()
|
||||
fmt.Printf("acquired lock, version: %d\n", version)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user