[fpc-pascal] Is System.IOResult thread-safe? (If not, I need to replace it.)
megabrutal at gmail.com
Wed Nov 10 14:13:39 CET 2010
2010/11/10 Jonas Maebe <jonas.maebe at elis.ugent.be>:
> The problem is that calling rewrite on an already opened file works fine (at
> least on Unix platforms). This program runs fine on Mac OS X and Linux:
> f: file;
> assign(f, 'test.txt');
> That's why I suggested the sysutils route, which enables you to specify the
> locking policy.
I should have noted this, but my "LockFile" is not a global variable.
It's a field of my object. So each object instance has its own
"LockFile", and threads create their own instance of the object.
However, they try to open the same file on the file system, but with
different file descriptors (under file descriptor, now I mean a Pascal
"file" typed variable).
The little program that would simulate it:
f, g: file;
I think it shouldn't work on any OS. Unless they open the file in
sharing mode, but I suppose Rewrite doesn't enable file sharing by
Thanks for your suggestion anyway, I guess FileOpen would really
eliminate my problem, however not because of file sharing, like you
More information about the fpc-pascal