All pastes #627781 Raw Edit

threads with back comms

public java v1 · immutable
·published 2007-07-20 14:46 UTC
rendered paste body
public class main{main(){for loop{ new bot(this);}}botdone(stuff){do things with stuff}}public class bot implements Runnable{boolean done;private Thread t;main theMain;bot(main startingMain){theMain = startingMain;//set up boring stuff.}public start(){done = false;t = new Thread(this);t.start();}public stop(){done = true;}public boolean isRunning(){return !done;}public run(){while (!done){// do stuff}theMain.botDone(my stuff)}