• 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: NSThread close (exit)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSThread close (exit)


  • Subject: Re: NSThread close (exit)
  • From: Christian Stieber <email@hidden>
  • Date: Wed, 05 Apr 2006 14:03:11 +0200

At 14:00 05.04.2006 +0200, Yorh wrote:

-(void)stopThread{

[NSThread exit];
}

Of course if I exit from the thread in this way the stopped thread is
the main one... How can I select a specific thread?

You can't. What you do is to define some form of telling the thread to quit within your protocol that tells the thread what to do. For example, if you have a simple producer/consumer relation, with the main thread sticking work packets into the queue and then waking up the child thread (traditionally this would be implemtned with a Condition lock), you could just define a BOOL ThreadQuit and have the child check that after it obtains the lock. Or, in the same case, if you want a "cleaner" exit you could declare that an NSNull instance in the work queue is the signal for the thread to quit.

Christian

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSThread close (exit)
      • From: Paul Forgey <email@hidden>
References: 
 >NSThread close (exit) (From: Yorh <email@hidden>)

  • Prev by Date: NSThread close (exit)
  • Next by Date: Re: How to tell linker to bind init at runtime
  • Previous by thread: NSThread close (exit)
  • Next by thread: Re: NSThread close (exit)
  • Index(es):
    • Date
    • Thread