• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Killing a thread by force
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Re: Killing a thread by force (From: Joshua Orr <email@hidden>)

  • Prev by Date: Re: Dynamic menu
  • Next by Date: To german speaking Cocoaists: article in german C't magazine
  • Previous by thread: Re: Killing a thread by force
  • Next by thread: Re: Killing a thread by force
  • Index(es):
    • Date
    • Thread