chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-hackers] [PATCH] make csi close stdin/stderr/stdout when ex


From: John Cowan
Subject: Re: [Chicken-hackers] [PATCH] make csi close stdin/stderr/stdout when exiting.
Date: Tue, 24 Apr 2012 10:17:22 -0400
User-agent: Mutt/1.5.20 (2009-06-14)

Christian Kellermann scripsit:

> the attached patch makes csi close its ports when interactively
> evaluating, i.e. running the REPL. This helps the new pastiche port to
> save its history in time and it should not hurt any other use
> cases. After all closing one's ports before exiting is just a bit more
> polite than relying on the OS process reaper...

I frankly see no point in this.  Stdio streams are closed by calling
exit(), and that's the appropriate time to kill them, when no further
user-level code can be performed.  What is more, they are *all* closed,
not just the three standard ones.

If a particular port type wants to take special action before the program
exits, it should register a procedure with the OS using atexit(), which
is available in both Posix and Win32.  Such procedures are called by
exit() just before streams are closed.  Note that on_exit and _onexit
are alternative, deprecated, names for this function.

-- 
All Gaul is divided into three parts: the part          John Cowan
that cooks with lard and goose fat, the part            http://ccil.org/~cowan
that cooks with olive oil, and the part that            address@hidden
cooks with butter. --David Chessler



reply via email to

[Prev in Thread] Current Thread [Next in Thread]