Re: Killing a thread by force
Re: Killing a thread by force
- Subject: Re: Killing a thread by force
- From: "Alastair J.Houghton" <email@hidden>
- Date: Tue, 20 May 2003 22:54:44 +0100
On Tuesday, May 20, 2003, at 09:56 pm, Joshua Orr wrote:
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.
Just make sure you declare the variable as "volatile", because
otherwise the compiler can "optimise" away the test, resulting in an
infinite loop. Even if it can't see where you set it to zero, I've
seen GCC change things so that it tests *once*, then runs an infinite
loop :->
Regards,
Alastair.
_______________________________________________
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.