strange zombie NSTask which never completes on certain machines...
strange zombie NSTask which never completes on certain machines...
- Subject: strange zombie NSTask which never completes on certain machines...
- From: "Ryan Poling" <email@hidden>
- Date: Tue, 19 Dec 2006 15:15:54 -0800
I'm having a very strange problem with an NSTask in my project. I'm
launching it from an NSTimer at a set repeated interval which works fine
on my PowerBook G4 (1.5 GHz). However, on an older G4 tower (400 MHz),
it starts working fine but then it always seems to hit a point where the
task stalls and *never* terminates (after successfully working a few
times). The only way to get it to work properly is to keep track of the
last time it worked successfully, and if it's been too long, manually
terminate the task and try again.
I have some code (see below) that the timer calls periodically. It
basically aborts the launching of the task if it thinks the task is
still running. But I run into this problem on the older G4 (and on some
MacBook Pro's) where the [scannerTask isRunning] starts returning YES
all the time and then I never get to process anything..
- (void)doScan:(NSTimer*)theTimer {
[scannerPool release];
scannerPool = [[NSAutoreleasePool alloc] init];
if (scannerProcessing || [scannerTask isRunning]) {
// this is the manual termination and restart code
if (nil != lastScanAttempt) {
if (fabsf([lastScanAttempt timeIntervalSinceNow]) > (5.0 *
scannerRefreshRate)) {
[self stopScanning]; // also calls terminate on the NSTask
[self startScanning];
return;
}
}
return;
}
[lastScanAttempt release];
lastScanAttempt = [[NSDate date] retain];
// ... more code
}
This is very strange behavior. Any ideas what could cause this? I'd
like to get rid of the time check - it's kind of a hack.
Thanks.
-Ryan
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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