Is spawn() safre in multi-thread application ?

bridged with qdn.public.qnxrtp.porting
Post Reply
YongSung Yoon

Is spawn() safre in multi-thread application ?

Post by YongSung Yoon » Sat Mar 15, 2003 2:24 am

Hi guys,

I read 'Currently, fork() is supported only in single-threaded application,
Don't mix fork() and threads' in the help of QNX 6.1.0A.
If so, is spawn() safe in multi-threaded application ?
And how about system() call ?

Regards,

Robert Rutherford

Re: Is spawn() safre in multi-thread application ?

Post by Robert Rutherford » Mon Mar 17, 2003 3:07 am

spawn() and system() are both thread-safe (as stated in the docs).

But... there are some issues if you have multiple threads each wait()-ing
for child processes to terminate. If you want to have multiple threads
waiting for child processes make sure each thread does a waitpid() for the
specific child it is interested in, rather than a generic wait(). This can
be a problem if you want mutiple threads each to wait for multiple children.

Note that system() does a waitpid() internally.

Rob Rutherford

"YongSung Yoon" <yongsung@kr.ibm.com> wrote in message
news:b4u1uh$ifk$1@inn.qnx.com...
Hi guys,

I read 'Currently, fork() is supported only in single-threaded
application,
Don't mix fork() and threads' in the help of QNX 6.1.0A.
If so, is spawn() safe in multi-threaded application ?
And how about system() call ?

Regards,

Post Reply

Return to “qdn.public.qnxrtp.porting”