home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.modula3
- Path: sparky!uunet!haven.umd.edu!decuac!pa.dec.com!src.dec.com!East.Sun.COM!Geoff.Wyant
- From: Geoff.Wyant@East.Sun.COM (Geoffrey Wyant - Sun Microsystems Labs BOS)
- Subject: re: Forking a threaded Modula 3 process
- Message-ID: <9212181327.AA10997@gidney.East.Sun.COM>
- Sender: daemon@src.dec.com (System programs)
- Organization: DEC Systems Research Center
- X-Content-Length: 1632
- X-To: m3
- Date: Fri, 18 Dec 92 08:27:55 EST
- X-Received: by gidney.East.Sun.COM (4.1/SMI-4.1)
- id AA10997; Fri, 18 Dec 92 08:27:55 EST
- Lines: 40
-
-
- > From: dagenais@vlsi.polymtl.ca (Michel Dagenais)
- > Newsgroups: comp.lang.modula3
- > Subject: Forking a threaded Modula 3 process
- > Date: 17 Dec 92 14:05:49 GMT
- > Organization: Ecole Polytechnique de Montreal, Canada
- >
- >
- > I want to communicate between a Modula 3 program and another already
- > written C program. Ideally, the C program should interact through its
- > stdin/stdout/stderr file descriptors. I know how to do that by creating
- > pipes, forking the Modula 3 program and exec on the C program. I am worried
- > about the multiple threads in the forked process however (they should not
- > attemps X windows output and so on). I suppose that adding an interface to
- > the "popen" unix call would be cleaner and safer. Advices?
- > --
- > ---------------------------------------------------------------------
- >
- > Prof. Michel Dagenais dagenais@vlsi.polymtl.ca
- > Dept of Electrical and Computer Eng.
- > Ecole Polytechnique de Montreal tel: (514) 340-4029
- >
- > ---------------------------------------------------------------------
- >
-
- The time between the fork and the exec should be short enough
- that threads shouldn't be a problem. After the exec, they will
- disappear. On a fast multi-processor, there would be a race condition,
- but there isn't much you can do without the requisite kernel support.
- Popen would suffer the same race condition as it ultimately does
- a fork and an exec as well. If you wanted to be squeaky-clean, you could
- have a C-based "exec server" that you sent a message to and it
- forked off the program of interest. That would eliminate any M3 threads
- from the picture.
-
- Hope this helps !
-
-
- --geoff
-
-