Closed vector-of-bool closed 3 years ago
This would be a very useful feature for us. We have been suffering from stalled locks when some process dies, and these locks will avoid it.
Hi @vector-of-bool, I missed your PR earlier, so I covered the shared/exclusive locks in https://github.com/harlowja/fasteners/pull/50
However, I really liked your approach to replace pywin32 by vendored code snippets, so I took them from your PR and added here: https://github.com/harlowja/fasteners/pull/57.
All the tests pass, but maybe you could take an extra look, to check if it is ok? In particular, after the failed lock attempt you were checking for error code ERROR_IO_PENDING = 997
, while I saw other code snippets checking for ERROR_LOCK_VIOLATION=33
(which I can trigger, so it seems to work).
The existing interprocess locking doesn't exposed shared lock ownership (read/write locking). This implements shared and exclusive locks using the native APIs rather than the limited APIs exposed by the Python stdlib.