Re: Killing a thread by force
Re: Killing a thread by force
- Subject: Re: Killing a thread by force
- From: Joshua Orr <email@hidden>
- Date: Tue, 20 May 2003 14:56:41 -0600
>
Hi,
>
>
In my Cocoa/Objective-C application, I'm using the ThreadWorker class to start
>
another thread from my application and from my own class, I'm calling
>
ThreadWorker in the following way:
>
[ThreadWorker workOn:self
>
withSelector:@selector(longTask:)
>
withObject:userInfo
>
didEndSelector:@selector(longTaskFinished:)];
>
>
The thread is working fine. But my requirement is when a button, say cancel is
>
clicked, the longTask method will quit and the thread will be killed. Can
>
anybody give me some idea, how can I stop the method longTask and kill the
>
thread for a button click?
>
>
TIA,
>
>
Raja
An idea I had was making a global variable set to true. When this global
variable is set to false (via the button click) the longTask method sees
this and returns, therefore the thread will be killed.
Just an idea I came up with just now, don't know how well it will work.
-Joshua D. Orr-
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.