[Mono-list] File Locking

Edward Ned Harvey (mono) edward.harvey.mono at clevertrove.com
Fri Sep 12 15:47:27 UTC 2014

Ack!  I just realized this doesn't work:
var lockFile = new FileStream("myfile.lock",FileMode.OpenOrCreate,FileAccess.ReadWrite,FileShare.None);

Particularly, if more than one application attempts to get an exclusive lock on that file at the same time (FileShare.None), then both applications simply succeed.  There is no exclusivity.

Is there some way to get file access exclusivity?

(I care about both Mac & Linux, but right now I'm observing this on Linux)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-list/attachments/20140912/d5ec2f77/attachment.html>

More information about the Mono-list mailing list