I am in process of writing a program whose logic is as below
1) MAIN thread will create four child threads T1,T2,T3,T4 and will die out 2)T2 should execute(run) when T1 has finished. 3)T3 should excute(run) when T2 has finished 4)T4 should execute(run) when T3 has finished
I am nt able to implement the 2,3 and 4 condition can anyone pls help out.... Thanks in advance
Well, you can't really control when the run() method get called. It will be called sometime after the thread is started.
However, if you are willing to change the logic of the run() method, you can have all the threads check a shared state variable, to determine when it should perform, it part of the application.