Try to fix flaky test.

This commit is contained in:
Nuno Cruces
2024-08-11 17:35:27 +01:00
parent 3649c1098e
commit d5583b6ec9

View File

@@ -72,28 +72,28 @@ func (s *vfsShm) Close() error {
return nil
}
// Unlock everything.
s.shmLock(0, _SHM_NLOCK, _SHM_UNLOCK)
vfsShmFilesMtx.Lock()
defer vfsShmFilesMtx.Unlock()
// Unlock everything.
s.shmLock(0, _SHM_NLOCK, _SHM_UNLOCK)
// Decrease reference count.
if s.vfsShmFile.refs > 1 {
s.vfsShmFile.refs--
s.vfsShmFile = nil
return nil
}
err := s.File.Close()
for i, g := range vfsShmFiles {
if g == s.vfsShmFile {
vfsShmFiles[i] = nil
break
s.vfsShmFile = nil
return err
}
}
err := s.File.Close()
s.vfsShmFile = nil
return err
panic(util.AssertErr())
}
func (s *vfsShm) shmOpen() (rc _ErrorCode) {
@@ -234,6 +234,8 @@ func (s *vfsShm) shmLock(offset, n int32, flags _ShmFlag) _ErrorCode {
s.vfsShmFile.lock[i] = -1
s.lock[i] = true
}
default:
panic(util.AssertErr())
}
return _OK
@@ -256,5 +258,4 @@ func (s *vfsShm) shmUnmap(delete bool) {
os.Remove(s.path)
}
s.Close()
s.vfsShmFile = nil
}