lockWithDeferreds: inlineable Unlock() (#603)

This commit is contained in:
YenForYang 2021-09-16 22:08:00 -05:00 committed by GitHub
parent b757b62cf4
commit 35ad29dccc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -15,10 +15,11 @@ func (me *lockWithDeferreds) Lock() {
}
func (me *lockWithDeferreds) Unlock() {
for _, a := range me.unlockActions {
a()
unlockActions := me.unlockActions
for i := 0; i < len(unlockActions); i += 1 {
unlockActions[i]()
}
me.unlockActions = me.unlockActions[:0]
me.unlockActions = unlockActions[:0]
me.internal.Unlock()
}