Re: Main Thread stoppin Background Thread
Re: Main Thread stoppin Background Thread
- Subject: Re: Main Thread stoppin Background Thread
- From: Joseph Kelly <email@hidden>
- Date: Fri, 28 Nov 2008 13:00:21 -0800
Go back in your email and look for the last message I sent in response
to your threading issues.
You can in fact use an instance variable to tell a worker thread to
quit (I do it all the time for very simple threads), and the fact that
you're setting the variable and yet you do not see the variable change
in either the worker or the main thread should be a really big clue.
Like maybe you've got a scoping issue.
Focus on developing some C and debugging skills before jumping into KVM.
On Nov 28, 2008, at 11:48, John Love <email@hidden> wrote:
Reference page 43 of Apple's MultiThreading.pdf.
I conclude from this page that the preferred, if not only, way to
have the main thread stop the background thread is through KVC.
Before I continue to inflict more pain on myself, why can't I simply
toggle the value of an instance variable of the class' interface
from the main thread and have the backgroundThreadRoutine look at
the same variable and break out of the background thread if its a
certain value?
I have been totally unsuccessful in this simpler-to-understand
approach; therefore, I am beginning to study KVC and its use on page
43 of Apple's doc.
Should I conclude that this class variable is in the main thread and
is not accessible by the background thread?
If KVC is the only approach for inter-thread communication, I'll
press on.
A short amount of guidance is definitely
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden