http://qs321.pair.com?node_id=714902


in reply to Re^2: What the flock!? Concurrency issues in file writing.
in thread What the flock!? Concurrency issues in file writing.

If you have to sort the results anyway, just dodge the bullet and have each of your processes write to separate files. Then sort the files into one. You can't sort until you get the last line anyway, so there is no loss of parallelism.

Also, a threaded solution is possible if you are interested.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^4: What the flock!? Concurrency issues in file writing.
by suaveant (Parson) on Oct 02, 2008 at 14:35 UTC
    I've thought about both of these, and I may actually look into the multiple file option since I could possibly write these subfiles in order, if I tweaked everything right.

    Threading is definately something I have thought of but would be a big change, not to mention getting up to speed on threads :)

                    - Ant
                    - Some of my best work - (1 2 3)