Skip to content

Commit

Permalink
lockWithDeferreds: inlineable Unlock() (#603)
Browse files Browse the repository at this point in the history
  • Loading branch information
YenForYang authored Sep 17, 2021
1 parent b757b62 commit 35ad29d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions deferrwl.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down

0 comments on commit 35ad29d

Please sign in to comment.