> Folks
>   Whats the best way to spawn an external process with wt on  
> freebsd. When i use system() even with fork() and wait() the wt  
> server locks up and continues to say "loading". Ive tried using  
> "daemon" command to just throw my process in the background and it  
> still wont work. I would like to use the progress indicator and show  
> the status if i could. Im running wt with boost threads. I grabbed  
> the latest verson about 2 months ago. Thanks for any help.

Generally speaking?  Avoid fork'ing from Wt if you can and have a  
different process do it for you, then capture the output.

This isn't a FreeBSD specific question.  The problem you're likely  
running in to is you're not setting fork handler for pthreads  
(pthread_atfork(3)) and aren't cleaning up existing Wt resources (such  
as threads before the exec).  Have you attached gdb to your Wt process  
to figure out what's going on when it blocks?  Are you installing per- 
thread signal handlers and catching SIGCHLDs?

IMHO, your best bet is to use fork(2) early on in your Wt startup  
process and have it exist as a dedicated process that you message from  
Wt, and have it fork(2) + exec(2) your new child commands.  Have the  
child manager pass a fd resource back to your Wt process (via dup(2),  
see Steven's for examples) and have it check the status of the fd with  
0 byte, non-blocking writes to the fd.

-sc

--
Sean Chittenden
[email protected]




------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to