You don't understand my problem. I'm programming 3D using Coin library. I use thread to draw faster. Example: I want to draw Truck, Vessel to display on a form.
If I don't use thread:
truck.draw();
vessel.draw();
form.show();
truck.draw();
vessel.draw();
form.show();
To copy to clipboard, switch view to plain text mode
Form will display truck & vessel.
But If i use thread:
truckthread.start(); // call truckthread.run(){draw()};
vesselthread.start(); // call vesselthread.run(){draw()};
form.show();
truckthread.start(); // call truckthread.run(){draw()};
vesselthread.start(); // call vesselthread.run(){draw()};
form.show();
To copy to clipboard, switch view to plain text mode
suppose at the time form.show() called, truckthread finished but vesselthread not finish. Form will only display truck. I want both truck & vessel displayed. Please solve it for me.
Finally, when use multithread, we must call start() for all threads, after that we must call wait() for all threads so that they finished before we call any commands after? Please view my tree:
thread1.start();
thread2.start();
// ...
threadn.start();
thead1.wait();
thead1.wait();
// ...
theadn.wait();
// you code after threads finished. At here, all threads finished?
thread1.start();
thread2.start();
// ...
threadn.start();
thead1.wait();
thead1.wait();
// ...
theadn.wait();
// you code after threads finished. At here, all threads finished?
To copy to clipboard, switch view to plain text mode
Bookmarks