Re: program hangs in exit()

Ulrich Drepper <[email protected]>
Newsgroups gmane.comp.lib.phil
Organization Red Hat, Inc.
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dan Kegel wrote:

> The standard says returning from main is the same as calling exit,
> exit says it closes all files, but read doesn't say the I/O will
> be interrupted if some other thread closes the file while the read is
> blocked.

The standard doesn't say anything about the situation where exit() is
called and there are other threads running except that in the end all
threads are gone.  This means the behavior of the threads which are
still running isn't guaranteed in any way anymore.  This situation has
to be avoided by the programmer if any negative effect is possible.

The I/O locking is one example.  The it is fine for the implementation
to assume locking isn't in effect anymore.  Therefore the LT behavior
was just fine.  One can argue that the current NPTL behavior is fine as
well and that it is a programmer's mistake to let it come to this.   And
in fact, it might be the safer option.

But we added to LT behavior back when because it became apparent that
most programmers don't pay attention to the shutdown process and hanging
processes are bad.


David Arnold <[email protected]>:

> see point two of Dave's answer to this Usenet query (i knew i'd seen
> this before

That's something completely different.

- -- 
- --------------.                        ,-.            444 Castro Street
Ulrich Drepper \    ,-----------------'   \ Mountain View, CA 94041 USA
Red Hat         `--' drepper at redhat.com `---------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+1W662ijCOnn/RHQRAv9yAJ9Xut6eEvy3BMX+vjHovYwpLpuhmwCbBwgm
umf/KZrAngscmE/ymTE56Jo=
=EUFq
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.