madelson / DistributedLock

A .NET library for distributed synchronization
MIT License
1.75k stars 182 forks source link

FileDistributedLock - Use FileSystemWatcher to optimize wait #145

Open madelson opened 1 year ago

madelson commented 1 year ago

We shouldn't rely solely on this (we'll still have a busy wait loop with timeouts), but this can allow us to wake up immediately whenever the lock file is deleted. With this we can have longer back-off times as well.

Potentially this would be a way to build an efficient Semaphore too.