[Date Prev][Date Next]
(ITS#7251) MDB shared mutexes ambiguous on Apple/Windows
Full_Name: Howard Chu
Submission from: (NULL) (18.104.22.168)
Submitted by: hyc
Currently since MacOSX and Windows don't support process-shared mutexes residing
in shared memory, MDB uses global named semaphores instead on these platforms.
The semaphore name is derived from a hash of the pathname of the lock file. This
approach was quick and dirty and is prone to failure if relative paths and
absolute paths are mixed, or if a file can be accessed thru multiple paths (e.g.
symlinks, loopback mounts, whatever).
Instead of the pathname, a unique file identifier of the lock file should be
used. For MacOSX we can obtain (device,inode) using fstat(). For Windows we can
obtain (dwVolumeSerialNumber,nFileIndexLow,nFileIndexHigh) using