Encapsulating Locked File Appends

Alexander Pánek alexander.panek at brainsware.org
Tue Mar 10 14:52:17 PDT 2009


dsimcha wrote:
> Is there an easy way to write a function, or a function already written for
> me, that will allow for a file shared between processes to be appended to
> safely?  This should be done in a way that will make it impossible for two
> processes to write to it at the same time, using locking, and should be
> platform-independent.
> 
> Performance does not matter because, in the use case I have, we're only
> talking about one update every few minutes.  Simplicity, however, does matter.
>  All I'm trying to do is run a simulation thousands of times on a bunch of
> different computers sharing an NFS file system and have all of the results end
> up in one nice plain text file instead of having each instance write to its
> own file and having to keep track of them and piece them together by hand.

Ideally you’d use a clustered file system for that, namely GFS (Global 
File System), OCFS(2) (Oracle, I think) or Lustre (Sun)... but I don’t 
know what your use-case is so you might not really need it.

0.02€



More information about the Digitalmars-d mailing list