Is spawn() safre in multi-thread application ?

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,

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,