• 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: 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.

  • Follow-Ups:
    • Re: Killing a thread by force
      • From: "Alastair J.Houghton" <email@hidden>
References: 
 >Killing a thread by force (From: "Raja Mallick" <email@hidden>)

  • Prev by Date: Re: NSRectFill not supporting compositing?????
  • Next by Date: Re: Killing a thread by force
  • Previous by thread: Killing a thread by force
  • Next by thread: Re: Killing a thread by force
  • Index(es):
    • Date
    • Thread