Documentation/learning/lock/client: Add defer Unlock (#11802)

release-3.5
Boqin Qin 2020-07-27 02:22:19 +08:00 committed by GitHub
parent 51de68ddac
commit 9006d8d4f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -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)