Alternative for API system() in multi-threaded app

Praveen kumar chatpravi at gmail.com
Mon Apr 22 05:51:00 EDT 2013


I was trying to replace system() API in my multi-threaded app as it is
suggested not to any calls in multi-threaded app which uses fork().....
When I was going through the man pages of fork()..in the Notes section I
found
    *   "Since version 2.3.3, rather than invoking the kernel's fork()
system call, the glibc fork() wrapper that is provided as part of the NPTL
threading implemenâ*
*       tation invokes clone(2) with flags that provide the same effect as
the traditional system call.  The glibc wrapper invokes any fork handlers
that have  been*
*       established using pthread_atfork(3)."*

Is this mean, I still can use fork() or any other API which uses fork() for
its implementation and make sure my app is thread safe or free from dead
locks????

Thanks,
Praveen R
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130422/98230784/attachment-0001.html 


More information about the Kernelnewbies mailing list