Skip to content

Commit

Permalink
#29 Fix race condition when try to lock mutex. (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
blaubaer committed Jan 4, 2024
1 parent ae7e1b9 commit 0deb6dc
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sync/mutex.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ func (instance *Mutex) Lock() error {
} else {
err = errors.New("Lock interrupted.")
}
} else if e, ok := p.(error); ok {
if e.Error() != "send on closed channel" {
panic(p)
} else {
err = errors.New("Lock interrupted.")
}
} else {
panic(p)
}
Expand Down

0 comments on commit 0deb6dc

Please sign in to comment.