Re: Killing a Thread
Re: Killing a Thread
- Subject: Re: Killing a Thread
- From: Mahaboob <email@hidden>
- Date: Wed, 03 Dec 2008 16:39:25 +0530
- Thread-topic: Killing a Thread
On 11/27/08 9:52 PM, "Scott Ribe" <email@hidden> wrote:
>> When I'm calling the thread for second time, the animation speed of progress
>> bar get increased.
>
> It seems pretty clear that your function never terminates. As we all have
> been telling you, if the function returns the thread will exit. You need to
> examine things in the debugger and determine what the function is doing and
> why it does not end.
I'm using an NSTimer to fire the thread in regular intervals and I was not
released the timer after sending mails to all email id's. Now I release the
timer from connectionTerminated: method. Now the thread is exiting.I used
one stop and continue button in the progress window to to stop and continue
the animation. When I'm calling the thread second time and then clicking
stop button, then it is not stopping animation and then clicking continue,
the animation speed get increased abnormally. And also it take more time to
send emails.
I did the code like :
timer = [[NSTimer scheduledTimerWithTimeInterval:(double)[txtTimeinterval
doubleValue] target:self selector:@selector(send:) userInfo:nil
repeats:YES]retain]; //to start the timer
And to invalidate I used
- (void) connectionTerminated: (NSNotification *) theNotification
{
NSLog(@"Connection Terminated");
if(stopProgressWindow)
{
[timer invalidate];
[timer release];
[self backgroundThreadTerminate]
[deliveryProgressWindow close];
}
RELEASE(_smtp);
}
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden