TCLUG Development Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fork/Exec on a multi-threaded Linux process?



First (old problem) C++ templates/linking:

I had posted here a few weeks back on problems with C++ templates and linking with gcc 2.91.66 on RedHat
6.1.  As it turned out once I upgraded to gcc 2.95.2 virtually all of my
template problems went away.  To sum up use 2.95.2 and don't use the
-frepo option for templates.   Just make sure the full implementation is
visible at the point of instantiation and gcc 2.95.2 takes care of the
rest (for me anyway).  I was able to crash the compiler on some complex
templates but doing some slight simplification I was able to get code to
compile and function properly.  No thread specific options are needed,
even though the current documentation would seem to indicate that -frepo
may be desirable (it needs to be updated).  Thanks for the pointers -
they did help - especially some of the binutil info.

Next - fork/exec on a multi-threaded process:

Now I am on to fork/exec from multi-threaded processes (using  standard
pthread support to establish a multi-threaded process).  My problem is
that I can fork/exec just fine from a single threaded process but when I
do so from a multi-threaded process all I get is another thread (I can
see the new PID but it has the same image name as the parent).  It is
like the exec is getting blocked somewhere along the way - though it
does not fail (does not return)?  Again this is code that works fine on
Digital Unix 4.0D, Solaris 2.7 and HP-UX 10.x and 11.x.

Does anybody know of any Linux specific issues when performing a
fork/exec from a multi-threaded process?
For my current test I am performing an immediate exec on just an xterm.   Works on single
threaded and hangs on multi-threaded process.

sjp