title: how to stop nsthread
body: <p>I am using a thread to update messages in background in my application. The thread is started in my messages class. </p>
  
  <p><strong>Messages.m</strong>  </p>
  
  <pre><code>timerThread = [[NSThread alloc] initWithTarget:self
                  selector:@selector(startTimerThread:) object:nil]; 
  [timerThread start];
  </code></pre>
  
  <p>now I want the thread to stop when the user signout of the application. For that in the signout method (in another class) I added </p>
  
  <pre><code>Messages *msg=[[Messages alloc]init];  
  [msg.timerThread cancel];  
  [msg release];  
  </code></pre>
  
  <p>But even after signing out of the application the thread is still running.</p>