Bebee
18th November 2008, 11:39
Hi,
I’ve got maybe simple question but I didn’t find appropriate answer jet. Can someone help me if there is an elegant way how to wake-up one thread (“consâ€) when several threads (“prodâ€) are finished. This code doesn’t work well:
Thread1 prod1;
Thread2 prod2;
.;
Thread3 prod3;
Thread cons;
prod1.start();
prod2.start();
.;
prod3.start();
prod1.wait();
prod2.wait();
.;
prod3.wait();
cons.start();
cons.wait();
Each of the threads is an instance of different object. I guess that QWaitCondition is useless since several producers are used.
Thk’s Vojta.
I’ve got maybe simple question but I didn’t find appropriate answer jet. Can someone help me if there is an elegant way how to wake-up one thread (“consâ€) when several threads (“prodâ€) are finished. This code doesn’t work well:
Thread1 prod1;
Thread2 prod2;
.;
Thread3 prod3;
Thread cons;
prod1.start();
prod2.start();
.;
prod3.start();
prod1.wait();
prod2.wait();
.;
prod3.wait();
cons.start();
cons.wait();
Each of the threads is an instance of different object. I guess that QWaitCondition is useless since several producers are used.
Thk’s Vojta.