RE: Re: gthread and fork/exec



Hi, Sebastian  

>To your program: It runs here without problems. But there are some
>problems, which make running fork in GLib multithreaded programs
>unreliable. Just now there is no g_thread_atfork command like in
>pthread. It would be needed to really make it work. See the
>pthread_atfork manpage, why this is needed.
>
>I don't think, we ever want to have anything like that in GLib however.
>Think of all the possible yummy deadlocks with pthread_atfork. That is
>not good. There is a very easy guideline: Do not mix threads/fork unless
>you don't use any glib funtions in the forked child. Period. g_spawn
>however looks save to use (instead of fork). We might want to add that
>info regarding threads/forks somewhere in the GLib documentation.
>
>So can you be a little more elaborate, why your program is failing.
>BTW easier to check than ("touch", "touch", "/tmp/testfile", NULL) would
>be ("echo", "echo", "hello world", NULL).
>
>Remove the g_message calls from the child. They might block forever, if
>fork was called, when the correspondiong mutex was just locked.
>

Thanks for the insight.  In my testing, I never see "hello world."
Basically, I just want to be able to run some scripts in different theards.
It seems execlp(....) never exec-ed.  The OS is 6.2 of RedHat.

Regards,

Lin 

 
-- 




__________________________________________________________________
Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/

Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]