home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / modula3 / 1086 < prev    next >
Encoding:
Text File  |  1992-12-21  |  2.1 KB  |  55 lines

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