In the documentation of the execl() function, it says that
“If you call this function from a process with more than one thread, all of
the threads are terminated and the new executable image is loaded and
executed. No destructor functions are called”.
My calling process is a multi-threaded process, and there will be
dynamically created arrays, pointers, fds and so forth that won’t be cleaned
up if the destructor does not get called.
My question is, what is the best procedure for running this execl()
function? without causing memory leaks, etc…
Any helps would be greatly appreciated.
inn.qnx.com <tburhan@dodo.com.au> wrote:
iqc > In the documentation of the execl() function, it says that
iqc > “If you call this function from a process with more than one thread, all of
iqc > the threads are terminated and the new executable image is loaded and
iqc > executed. No destructor functions are called”.
iqc > My calling process is a multi-threaded process, and there will be
iqc > dynamically created arrays, pointers, fds and so forth that won’t be cleaned
iqc > up if the destructor does not get called.
iqc > My question is, what is the best procedure for running this execl()
iqc > function? without causing memory leaks, etc…
iqc > Any helps would be greatly appreciated.
Signal all of your threads to end.
Use a barrier to wait for them to finish.
then use execl().
P.S. While there may very well be things that you need to clean up, I
don’t think memory leaks is one of them. I believe that the OS will
clean up any memory that you may have allocated.
–
Bill Caroselli – Q-TPS Consulting
1-(708) 308-4956 <== Note: New Number
qtps@earthlink.net