On 11/14/2012 05:16 PM, H. S. Teoh wrote:
If you're on Posix, you can use file locks to ensure atomic writes to
the file (all threads have to use it though: it's only an advisory lock,
not a mandatory lock): see the manpage for fcntl, look for F_GETLK.

I take it there's no more "native-to-D" way of implementing a file lock? :-(

I was browsing through the library descriptions of Mutex and ReadWriteMutex, but it's not clear how they'd apply to this case (parallelism is really something I have very limited experience of). I'm actually inclining towards an alternate solution, where the different threads send back results to the master thread which integrates them and writes out everything itself.

Reply via email to