Re: Loading NIB file from forked process
Re: Loading NIB file from forked process
- Subject: Re: Loading NIB file from forked process
- From: Will Mason <email@hidden>
- Date: Sat, 12 Feb 2005 03:24:04 -0800 (PST)
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
> > Within one of my Obj-C methods I'm forking off a child process so
> that
> > I can do various tasks without blocking the GUI. Depending on the
> > outcome of these tasks, I need to display a dialog box. The
> problem is
> > that the NIB file doesn't load and consequently the dialog doesn't
> > appear.
>
> You can't do this. You cannot use the high-level frameworks (where
> use
> is link against), fork() and expect stuff to work in the child
> process. The only thing you can really do is immediately exec
> yourself
> with another flag.
>
> However, it sounds like you shouldn't be forking anyway. What you
> want
> is a thread.
Yes, from what little we know about what you're trying to accomplish,
it seems like you really should be using threads instead of child
processes (particularly as your stated purpose is to avoid blocking the
GUI). Always prefer threads unless there is something specific
preventing it. If you use a thread, then choosing to display or not
display the dialog box is trivial. If you must use a child process,
then it's a bit more complicated, but not so much that it's impossible.
You just need to know how to monitor the state of the child process.
Keeping track of the output of child processes and sending data to them
has been covered in this forum before. Please consult the archives if
this is what you need.
Will
_______________________________________________
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