[fpc-pascal] Threaded file access contention - Windows
afpTeam
afpteam at sbcglobal.net
Tue Mar 27 15:57:32 CEST 2007
Hi,
I'm writing a console Client/Server that will run on Win98 through XP using
thread managed Lnet in objfpc mode . It has a couple of ASCII text files
that it writes to internally and reads from depending upon external client
requests.
The client requests are callback based from the arrival of data at the
socket, so I'm concerned if incoming client file read requests from a socket
operation on one thread could run into file writes the server is in the
process of making on the same file, in another thread.
Is there a particular text or file I/O approach in FP, that is better suited
than others, such as opening for shared mode access, or using the Windows
API based calls, or typed text, etc? Or is an AssignFile process with
catch/try error management generally considered the best way to test and
delay if file access contention occurs?
The multi-client reads have a higher priority, so would "CriticalSection" be
the best route to manage this?
Thanks in advance
Mike
More information about the fpc-pascal
mailing list