i have class creates threads, like:
for (int = 0; < t.size(); i++) { system.out.println("[thread] info: " + t.tostring()); r = new rt(t.get(i).getgridpath(), t.get(i).getidtower()); thread rthread = new thread(r); rthread.start(); pids.add(rthread.getname()); } gup = new gridupdate(pids); thread updategrid = new thread(gup); updategrid.start();
the function of updategrid thread check if status of each rthread terminated. when true, updategrid bunch of function.
how can state of each rthread updategrid class?
take note im passing threads pid constructor , inside of run() method have statement, return new meaning new thread.
for (int = 0; < pids.size(); i++) { t = new thread(pids.get(i)); system.out.println(t.getstate()); }
as @svasa commented, changed list type list<string>
list<thread>
, added each thread list, like:
pids.add(rthread);
so, done!
thanks @svasa!
Comments
Post a Comment