home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!darwin.sura.net!jvnc.net!yale.edu!ira.uka.de!smurf.sub.org!news
- From: urlichs@smurf.sub.org (Matthias Urlichs)
- Newsgroups: comp.unix.programmer
- Subject: Re: Fork ?
- Date: 28 Jul 1992 22:52:57 +0200
- Organization: University of Karlsruhe, FRG
- Lines: 39
- Message-ID: <154c39INNqrl@smurf.smurf.sub.org>
- References: <1992Jul6.010103.22037@news.uiowa.edu> <431@highett.mel.dbce.csiro.au>
- NNTP-Posting-Host: 127.0.0.1
-
- In comp.unix.programmer, article <431@highett.mel.dbce.csiro.au>,
- kang@mel.dbce.csiro.au (Kang Ho) writes:
- < In article <1992Jul6.010103.22037@news.uiowa.edu> gdcarson@icaen.uiowa.edu (Gregory Donald Carson) writes:
- < > I have a question about fork's. I have a C program that I need to call
- < > repeatedly. [...deleted...]
- < > The C program that I need to call takes a long time to run, and I want it
- < > to run, while the main program continues. I have heard of a thing called
- < > a fork, and was hoping someone could [...deleted...]
- < > The C program that I wish to call is passed an image data array, and
- < > then displays it, its normal quit returns control to the calling program.
- <
- < The program fragment is as follows:
- < main()
- < {
- < int pid;
- <
- < if ((pid=fork())<0){
- < perror("fork unsuccessful");
- < exit(-1);
- < }
- < else if (pid==0){
- < /* child process */
- < execl("/bin/imgdisp","imgdisp","param1",(char *)0);
- perror("imgdisp gone");
- exit(-1);
- < }
- < else {
- < /* parent process */
- < wait((int *)0);
- < }
- < ...
- < }
-
- --
- "I'd love to go out with you, but I did my own thing and now I've got
- to undo it."
- --
- Matthias Urlichs -- urlichs@smurf.sub.org -- urlichs@smurf.ira.uka.de /(o\
- Humboldtstrasse 7 -- 7500 Karlsruhe 1 -- Germany -- +49-721-9612521 \o)/
-