attilio
October 16th, 2005, 08:33 AM
hi guys,
My code runs a thread, then another one. If 1 thread recieves a specific command it needs to be able to close the other thread - stop it from processing anything.
Atm both the threads run a while(true) {
} statement.
If 1 thread recieves the command to stop the other then it flags, t[1].kill =1; where t[1] = the path to the other thread.
This thread, on the next data input checks if t[this.i].kill==1, if so runs the break; command and closes itself....
It works fine, but it has to recieve data to be closed, if data isn't recieved it wont check t[this.i].kill and wont break; to close
I want to know If I can close it from the other thread, ie instead of flagging a variable, t[1].kill = 1, it does something like t[1].close(); or something.....
any ideas appreciated thanks
My code runs a thread, then another one. If 1 thread recieves a specific command it needs to be able to close the other thread - stop it from processing anything.
Atm both the threads run a while(true) {
} statement.
If 1 thread recieves the command to stop the other then it flags, t[1].kill =1; where t[1] = the path to the other thread.
This thread, on the next data input checks if t[this.i].kill==1, if so runs the break; command and closes itself....
It works fine, but it has to recieve data to be closed, if data isn't recieved it wont check t[this.i].kill and wont break; to close
I want to know If I can close it from the other thread, ie instead of flagging a variable, t[1].kill = 1, it does something like t[1].close(); or something.....
any ideas appreciated thanks