execl() question, please help

bridged with qdn.public.qnxrtp.x86
Post Reply
inn.qnx.com

execl() question, please help

Post by inn.qnx.com » Fri Nov 28, 2003 1:19 am

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.

ed1k

Re: execl() question, please help

Post by ed1k » Fri Nov 28, 2003 1:47 am

In article <bq66jq$mii$1@inn.qnx.com>, tburhan@dodo.com.au says...
In the documentation of the execl() function, it says that
Please do not spame these newsgroups. I have been reading it third time for this evening.
Best regards,
Eduard
"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.


John Nagle

Re: execl() question, please help

Post by John Nagle » Wed Dec 24, 2003 7:59 am

You can call "spawn" from a multi-threaded program, if you want
to launch another program and continue the one you are in.

"exec", in a program with multiple threads, is not a good thing.
You're yanking the code out from under running threads, so the
system has to kill them.

QNX does not implement "fork" for a program with multiple
threads. There are UNIX variants that do, although the semantics
vary.

John Nagle
Team Overbot

inn.qnx.com wrote:
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.

Post Reply

Return to “qdn.public.qnxrtp.x86”