更新时间:2022-11-09 13:57:28
我会尝试在每个bot中使用boolean isRunning
,在run方法中使用while(isRunning)
.然后在第四个线程中,检查所有的机器人,看看是否完成了.如果已完成,请将其他机器人的isRunning
设置为false
,它们应退出.
I would try having a boolean isRunning
in each bot and in the run method have a while(isRunning)
. Then in a fourth thread, check through all of the bots and see if any are done. If one is done, set the isRunning
of the others bots to false
and they should exit.