diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/internal/poll/fd_mutex.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/internal/poll/fd_mutex.go b/src/internal/poll/fd_mutex.go index aba22e9867..300628db79 100644 --- a/src/internal/poll/fd_mutex.go +++ b/src/internal/poll/fd_mutex.go @@ -269,7 +269,9 @@ func (fd *FD) readWriteLock() error { return errClosing(fd.isFile) } if !fd.fdmu.rwlock(writeLock, waitLock) { - fd.fdmu.rwunlock(readlock) // unlock read lock acquired above + if fd.fdmu.rwunlock(readlock) { + fd.destroy() + } return errClosing(fd.isFile) } return nil @@ -286,7 +288,9 @@ func (fd *FD) tryReadWriteLock() (bool, error) { return false, nil } if !fd.fdmu.rwlock(writeLock, tryLock) { - fd.fdmu.rwunlock(readlock) // unlock read lock acquired above + if fd.fdmu.rwunlock(readlock) { + fd.destroy() + } if fd.closing() { return false, errClosing(fd.isFile) } |
