Link to home
Start Free TrialLog in
Avatar of thready
thready

asked on

simple java question

An example in "android developer's cookbook", p. 57, shows how to stop a thread with the following:
If(myThread != null) {
   Thread dummy = myThread;
   MyThread = null;
   dummy.interrupt();
}

My question is, why not just do this?
If(myThread != null) {
   myThread.interrupt();
   myThread = null;
}

Are these not equivalent?

Thanks,
Mike
ASKER CERTIFIED SOLUTION
Avatar of dpearson
dpearson

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of thready
thready

ASKER

Thanks guys.  Things that make you go hmmmm.....  :o)