Subject: | |
From: | |
Reply To: | |
Date: | Wed, 6 Sep 1995 17:15:17 +1000 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
At 02:52 PM 5/9/95 GMT, Ross Ridge wrote:
>>2) terminate with an _exit() rather than the (implied) exit()
>
>Bad idea. The implied exit() *is* flushing the stdio buffers, otherwise
....
>If exit() were used instead of _exit() in this example, it could result
>in the message being printed twice, once in the parent process and once
>in the child process.
Not knowing exactly what the person's program was doing, the suggestion for
_exit() was more basic. While what you say will prevent the message from
printing twice, it can prevent it from printing at all. Where shared
descriptors are present from a vfork(), the exit() function in the child
will not only flush the buffers but close the file too. As a result, when
the parent process attempts to print to this descriptor it will fail --
closed file. So instead of only one error message, it may result in none.
I've been caught on this on our HP-UX systems before.! :) I don't know the
status of this on MPE systems.
Regards.
----
Jim "seMPEr" Wowchuk Internet: [log in to unmask]
Vanguard Computer Services Compu$erve: 100036,106
_--_|\ Post: PO Box 18, North Ryde, NSW 2113
/ \ Phone: +61 (2) 888-9688
\.--.__/ <---Sydney NSW Fax: +61 (2) 888-3056
v Australia
|
|
|