
2 Feb
2009
2 Feb
'09
9:03 p.m.
Edouard A wrote:
On Mon, 02 Feb 2009 17:41:58 +0000, "Phil Endecott" <spam_from_boost_dev@chezphil.org> wrote:
So basically it's something like this:
thread t( sort(begin,mid) ); sort(mid,end); t.join(); merge(begin,mid,end); // [*]
Exactly, with some differences as I do a memory copy before the thread and I run two threads.
Working on different buffers allows to prevent hidden system locks when you reach the middle.
so it's more like
buffer = new []; copy(...) thread t1(sort(buffer,...);
buffer2 = new []; copy(...) thread t2(sort(buffer2, ...);
t2.join(); t1.join();
merge(buffer, buffer2, result);
That's a lot of extra copying. What do you mean by "hidden system locks"? Phil.