Hello,
this problem is more exotic than you think. i'm using 2 threads to draw pixels on the screen like this:
Code:
// draw upper half here
ThreadPool.QueueUserWorkItem(delegate
                {
// draw pixels here
}, null);

// draw lower half here
ThreadPool.QueueUserWorkItem(delegate
                {
// draw pixels here
}, null);
and after that piece of code i need to pause the main thread UNTIL the both threads above have finished. of course the simplest thing would be to just set two variables and do this:
Code:
while(!thread1_finished || !thread2_finished) Thread.Sleep(1);
but that is bad, because the operations above take far less then 1 millisecond. so how do i run these two operations simultaneously and wait for both to finish?

any help appreciated. thanks.