|go ahead... be a heretic|
Re: using parallel processing to concatenate a string, where order of concatenation doesn't matterby BrowserUk (Pope)
|on Oct 18, 2006 at 17:04 UTC||Need Help??|
Try this. I've used a randomly variable 'work pause', as if this is constant, the threads will obviously finish in the same order as they started.
Update: Applied locks per ikegami's post below.
If you don't like the shared buffer being passed to the threads through closure--it smacks of globals--then you could use this version that passes a reference to the shared buffer to the threads as an argument and dereferences it when appending:
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.