Skip to content

Commit

Permalink
Release lock before .WaitUntil, as it may cause a deadlock when testi…
Browse files Browse the repository at this point in the history
…ng parallel objects.

Address #167: Unable to test concurrent objects
  • Loading branch information
anpez committed May 19, 2015
1 parent dab07ac commit 547cd8e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mock/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,9 @@ func (m *Mock) Called(arguments ...interface{}) Arguments {

// block if specified
if call.WaitFor != nil {
m.mutex.Unlock()
<-call.WaitFor
m.mutex.Lock()
}

if call.Run != nil {
Expand Down

0 comments on commit 547cd8e

Please sign in to comment.