public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Forking a Process
@ 2006-06-17 15:54 Christian Heller
  2006-06-19 17:12 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Heller @ 2006-06-17 15:54 UTC (permalink / raw)
  To: gcc-help

Hi,

in case I am wrong here to ask, please tell me where else to ask instead!
The glibc page did not offer a "help" mailing list; therefore I post here.
I HAVE READ the manual and many web pages but nevertheless got questions.

I code on a C interpreter project called "CYBOI": http://www.cybop.net
The CYBOI interpreter has one single signal loop and many allocated
resources, as well as some mutexes and several threads.
I'd simply like to start an external program from within CYBOI.
The manuals describe two possibilities:
1 "pthread_create" copying all threads into the new child process
2 "fork" copying only the main thread -- the one that called "fork"

Since I just want to run some external program like "ls", "xdosemu",
"kmail", ... (whatever), without having any control about it,
I chose to use the second possibility, namely "fork".
Now I have just one thread in the child process, but still all the
resources of the parent process (including signal loop?) duplicated.
(By the way, I have taken care that the threads of the parent process
do *not* allocate any resources that could not be freed in the child,
since there, the threads do not exist.)

Questions:

1 Do I have to deallocate all duplicated resources in the child process,
  right after the "fork" and before running an "exec"?
  (The new child process runs an external program that does not need them.)

2 Isn't there a simpler way of starting an external program?
  I cannot imagine that a desktop environment like KDE, for example,
  starts applications with "fork" which copies all resources every time.

Thanks a lot for any hints,
Christian

(Please also address to me, since I'm not in the list!)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Forking a Process
  2006-06-17 15:54 Forking a Process Christian Heller
@ 2006-06-19 17:12 ` Ian Lance Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2006-06-19 17:12 UTC (permalink / raw)
  To: Christian Heller; +Cc: gcc-help

Christian Heller <christian.heller@tuxtax.de> writes:

> in case I am wrong here to ask, please tell me where else to ask instead!
> The glibc page did not offer a "help" mailing list; therefore I post here.
> I HAVE READ the manual and many web pages but nevertheless got questions.

Wrong mailing list.  Try comp.unix.questions.

Ian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-06-19 17:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-17 15:54 Forking a Process Christian Heller
2006-06-19 17:12 ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).