Re: Exclusive Writes to a file.
- From: "Olaf Baeyens" <olaf.baeyens@xxxxxxxxxx>
- Date: Thu, 31 Mar 2005 11:26:40 +0200
> If two applications try to write to the same file at the same time,
> an exception gets thrown. How can we handle exclusive writes to a file?
>
This is an art on its self.
Best is to do retries with a randomized interval.
For example try to open the file with 10 retries but wait about 0.5 second
between each trial of opening.
But this means that the time of the open and close of that file should be
less that 5 seconds. Otherwise the other application will fail if it cannot
open in 5 seconds. One solution to speed up is to prepare the data before
you are going to write in a memory block and transfer the complete block in
one pass.
An alternative way is record locking.
--
http://www.skyscan.be
.
- Follow-Ups:
- Re: Exclusive Writes to a file.
- From: L
- Re: Exclusive Writes to a file.
- References:
- Exclusive Writes to a file.
- From: L
- Exclusive Writes to a file.
- Prev by Date: Windows and Forms Authentication at the same time ???
- Next by Date: Dynamic Invoke from Unmanaged DLL (CompactFramework, WjnCE.NET 5, vs 2003, C#)
- Previous by thread: Re: Exclusive Writes to a file.
- Next by thread: Re: Exclusive Writes to a file.
- Index(es):
Relevant Pages
|