[Mono-dev] Problems with FileStream.Lock();

Jonathan Pryor jonpryor at vt.edu
Tue Jan 8 22:21:23 UTC 2013


On Jan 8, 2013, at 4:44 PM, Terry-Watts.com <Terry at Terry-Watts.com> wrote:
> I have check the Android API docs and file locking has been available on channels since API Level 1.

"on channels"?

Anyway, quick perusal of the source shows that FileStream.Lock() is fcntl(2):

	https://github.com/mono/mono/blob/master/mcs/class/corlib/System.IO/FileStream.cs#L875
	https://github.com/mono/mono/blob/master/mcs/class/corlib/System.IO/MonoIO.cs#L414
	https://github.com/mono/mono/blob/master/mono/metadata/file-io.c#L1191
	https://github.com/mono/mono/blob/master/mono/io-layer/locking.c#L117
	https://github.com/mono/mono/blob/master/mono/io-layer/locking.c#L26

So, why is fcntl(2) failing? I don't know, you're swallowing the exception.

 - Jon



More information about the Mono-devel-list mailing list