Re: NSThread close (exit)
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