Skip to content

Commit 0deb6dc

Browse files
authored
#29 Fix race condition when try to lock mutex. (#30)
1 parent ae7e1b9 commit 0deb6dc

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

sync/mutex.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ func (instance *Mutex) Lock() error {
4040
} else {
4141
err = errors.New("Lock interrupted.")
4242
}
43+
} else if e, ok := p.(error); ok {
44+
if e.Error() != "send on closed channel" {
45+
panic(p)
46+
} else {
47+
err = errors.New("Lock interrupted.")
48+
}
4349
} else {
4450
panic(p)
4551
}

0 commit comments

Comments
 (0)