Skip to content

Commit

Permalink
Merge pull request #61 from mlaventure/prevent-deadlock
Browse files Browse the repository at this point in the history
Don't increment the wait count if the file is closing
  • Loading branch information
darstahl authored Jul 24, 2017
2 parents c4dc130 + 1ba55a6 commit 3e5ddb0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion file.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ func (f *win32File) Close() error {
// prepareIo prepares for a new IO operation.
// The caller must call f.wg.Done() when the IO is finished, prior to Close() returning.
func (f *win32File) prepareIo() (*ioOperation, error) {
f.wg.Add(1)
if f.closing {
return nil, ErrFileClosed
}
f.wg.Add(1)
c := &ioOperation{}
c.ch = make(chan ioResult)
return c, nil
Expand Down

0 comments on commit 3e5ddb0

Please sign in to comment.