Re: NSTask flaky about posting terminate notification, in 10.6
Re: NSTask flaky about posting terminate notification, in 10.6
- Subject: Re: NSTask flaky about posting terminate notification, in 10.6
- From: Dave Keck <email@hidden>
- Date: Wed, 2 Sep 2009 12:25:33 -1000
In the past I've also had some issues with NSTask, its 'isRunning'
property and NSTaskDidTerminateNotification, albeit on 10.5. Here's
two notes based on what I've experienced:
o Recently I've found myself rolling my own solutions to problems such
as yours, in order to guarantee its level of robustness. To check
whether this is necessary, I'd recommend the usual tactic of whittling
down your code to the smallest example possible that still exhibits
the problem. In doing so you'll likely gain some insight into where
the problem is, and if not, at least you'll have an example project
ready for a bug report.
o Can you use waitpid() instead of polling? Or do you need the run
loop to be running while you're polling, waiting for the process to
exit?
And a general design comment:
After a cursory read over your code, I'm wondering why you need to
wait for the process to exit, and couldn't just wait for a
notification to be sent and deal with it when the time comes (assume
for a second that the notification is always sent.) In cases such as
this, refactoring my own code to be more event-driven has been the
better choice overall. Of course, every case is different...
But that doesn't solve your problem of the notification not being sent
in the first place: if and when you've verified that the bug isn't in
your code, I'd recommend rolling your own using a separate thread with
either waitpid() or a kqueue.
_______________________________________________
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