From the main Thread, I call:


[NSThread detachNewThreadSelector:@selector(bgThread:) toTarget:self withObject:nil];



- (void) bgThread:(NSConnection*)connection {

    NSAutoreleasePool *pool;

    pool = [[NSAutoreleasePool alloc] init];



    [self doCalculation];



[self performSelectorOnMainThread:@selector(endBgCalculation:) withObject:nil waitUntilDone:NO];



    [pool release];

}



- (void) endBgCalculation:(id)obj {

        // stuff

}



I believe this is fairly standard way to institute a background thread …



The problem centers on letting the background Thread look at a parm set in the main Thread and break out of the background Thread when the background Thread sees a certain value.



Specifically, my –doCalculation is just one great time-consuming for- loop that looks at mainThreadParm and breaks depending on the value of mainThreadParm.



I change mainThreadParm in the main Thread and I expect the background Thread to break when the background Thread sees a certain value of mainThreadParm.



The background thread sees the initial value of mainThreadParm, but does not break when the main Thread changes it.



This sounds so basic and fundamental that I really feel lacking on this subject.



John Love

 _______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to