Article View: borland.public.cppbuilder.nativeapi
Article #13398Re: Multiple Threads & One Text File
From: Dennis Jones
Date: Wed, 15 Oct 2003 15:42
Date: Wed, 15 Oct 2003 15:42
38 lines
2356 bytes
2356 bytes
"Hans Galema" <dontusethis@dontusethis.nl> wrote in message news:3f8ced2e@newsgroups.borland.com... > Dennis Jones wrote: > > > At first I thought specifying the appropriate file sharing modes would work, > > but then I realized that that would only work to block access to the file > > for other processes running on the SAME machine. > > Is that true ? Hard to believe. If you lock the file (and get the lock) > the access will to blocked by the os on the shared machine for others Well, I don't know for sure, I haven't actually tried it yet -- just trying to get suggestions before I start work on it. I was assuming that any kind of file locking being done by the OS would have to be done with some sort of internal kernel object, which of course, no other machine would know about. > > > Any additional ideas would be welcome. > > Isn't appending to a file with fwrite() an atomic process ? No, I don't think so, not even for multiple processes/threads on the same machine. > > Every client could open the file once for a whole session. > You do not have to lock. After fwrite() you could flush. I would be very suspicous of code that did that. > That would be all. Unfortunately, I think there is a lot more to it than that. - Dennis
Technical Details
Message-ID:
<3f8d6af9$2@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!priapus.visi.com!zeus.visi.com!news-out.visi.com!petbe.visi.com!ash.uu.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<3f88f22a@newsgroups.borland.com> <3f890078$1@newsgroups.borland.com> <3f8cc993$1@newsgroups.borland.com> <3f8ced2e@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,2cf03e35cbac1db7 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-10-15 08:54:32 PST From: "Dennis Jones" <djones@nospam.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3f88f22a@newsgroups.borland.com> <3f890078$1@newsgroups.borland.com> <3f8cc993$1@newsgroups.borland.com> <3f8ced2e@newsgroups.borland.com> Subject: Re: Multiple Threads & One Text File Date: Wed, 15 Oct 2003 08:42:50 -0700 Lines: 40 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 204.200.27.7 Message-ID: <3f8d6af9$2@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1066232569 204.200.27.7 (15 Oct 2003 08:42:49 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!priapus.visi.com!zeus.visi.com!news-out.visi.com!petbe.visi.com!ash.uu.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail