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

Terry-Watts.com Terry at Terry-Watts.com
Tue Jan 8 22:44:55 UTC 2013


Channels are what they seem to call any I/O path.
http://developer.android.com/reference/java/nio/channels/package-summary.html

The actual exception thrown is:
"Lock violation on path 
/mnt/sdcard/external_sd/TestDb/Test.Tbl"{System.IO.IOException: Lock 
violation on path /mnt/sdcard/external_sd/TestDb/Test.Tbl
   at System.IO.FileStream.Lock (Int64 position, Int64 length) [0x00000] 
in <filename unknown>:0
   at TrwLinqDb.Streams.LockedStream.Lock () [0x00025] in 
d:\MyWorkSpace\C Sharp\TrwLinqDb\TrwLinqDb\Streams\LockedStream.cs:90 }

Regards
Terry



On 9/01/2013 9:21 AM, Jonathan Pryor wrote:
> 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