ce3wa3bh@maccs.dcss.mcmaster.ca (Eric Ho) (02/22/91)
In my progam, two process are spawned, what this two processes doing is the parent process write a message to the pipe, and the child process read the message from the pipe. After the parent process finished writting, should I close the pipe write end file descriptor immediately, or leave this to the child. What's the difference between the parent close the write end file descriptor and the child close the write end descriptor? Please reply using e-mails, thanks in advance! -- Cheers, 9041477@mcmaster.bitnet Eric Ho ce3wa3bh@maccs.dcss.mcmaster.ca McMaster University, Ontario, Canada ...uunet!utai!utgpu!maccs!ce3wa3bh
session@uncw.UUCP (Zack C. Sessions) (02/27/91)
dxl2585@cs.rit.edu (Derek X Lee-Wo) writes: >In article <27C4E07F.6689@maccs.dcss.mcmaster.ca> ce3wa3bh@maccs.dcss.mcmaster.ca (Eric Ho) writes: >>In my progam, two process are spawned, what this two processes doing is >>the parent process write a message to the pipe, and the child process >>read the message from the pipe. After the parent process finished writting, >>should I close the pipe write end file descriptor immediately, or leave this >>to the child. >When the child process is spawned, it inherits an identical set of file >descriptors as the parent. This actually is machine/compiler dependent. While true in UNIX, it is not necessarily true with all implementations of C. Not being familiar with ANSI C, maybe this is in ANSI C? Zack Sessions ...!ecsvax!uncw!session
torek@elf.ee.lbl.gov (Chris Torek) (02/27/91)
>>In article <27C4E07F.6689@maccs.dcss.mcmaster.ca> >>ce3wa3bh@maccs.dcss.mcmaster.ca (Eric Ho) writes: >>>In my progam, two process are spawned, ... pipe ... >In article <2171@cs.rit.edu> dxl2585@cs.rit.edu (Derek X Lee-Wo) writes: >>When the child process is spawned, it inherits an identical set of file >>descriptors as the parent. In article <1020@uncw.UUCP> session@uncw.UUCP (Zack C. Sessions) writes: >This actually is machine/compiler dependent. While true in UNIX, it >is not necessarily true with all implementations of C. Not being >familiar with ANSI C, maybe this is in ANSI C? ANSI C (and indeed each other variation on C) has neither `processes' nor `pipes' as a concept. The fact that there happen to be functions in your C library that implement both does not mean they are suitable for comp.lang.c discussions (unless perhaps you want to propose fork/join operations in a new variation on C). (See, e.g., Mesa or Ada language manuals for a description of fork/join.) In other words, this whole topic is O/S dependent, and should move to some O/S-specific newsgroup. -- In-Real-Life: Chris Torek, Lawrence Berkeley Lab EE div (+1 415 486 5427) Berkeley, CA Domain: torek@ee.lbl.gov
dave@tygra.UUCP (David Conrad) (03/03/91)
In article <2171@cs.rit.edu> dxl2585@cs.rit.edu (Derek X Lee-Wo) writes: >In article <27C4E07F.6689@maccs.dcss.mcmaster.ca> ce3wa3bh@maccs.dcss.mcmaster.ca (Eric Ho) writes: >>In my progam, two process are spawned, what this two processes doing is >>the parent process write a message to the pipe, and the child process >>read the message from the pipe. After the parent process finished writting, >>should I close the pipe write end file descriptor immediately, or leave this >>to the child. > >When the child process is spawned, it inherits an identical set of file >descriptors as the parent. > >At that point, the child should immediately close the write file descriptor to >the pipe and the parent should close its read file descriptor to the pipe. > >[etc.] What the SHPX does any of this have to do with C? -- David R. Conrad sharkey!tygra!dave -- = CAT-TALK Conferencing Network, Computer Conferencing and File Archive = - 1-313-343-0800, 300/1200/2400/9600 baud, 8/N/1. New users use 'new' - = as a login id. AVAILABLE VIA PC-PURSUIT!!! (City code "MIDET") = E-MAIL Address: dave@DDMI.COM