[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] quick port question
From: |
Peter Keller |
Subject: |
Re: [Chicken-users] quick port question |
Date: |
Sat, 24 Feb 2007 18:40:52 -0600 |
User-agent: |
Mutt/1.4.2.1i |
On Sat, Feb 24, 2007 at 04:38:16PM -0500, Graham Fawcett wrote:
> On 2/24/07, felix winkelmann <address@hidden> wrote:
> >On 2/23/07, john <address@hidden> wrote:
> >> Hi. Are ports automatically closed when out of scope?
> >
> >No. You could set a finalizer, though.
>
> It seems to me that *all* ports should be closed upon finalization,
> unless explicitly told not to. That is, all ports should have
> close-*-port as a default finalizer, and there should be a procedure
> available to unregister the finalizer in the rare cases where it
> matters to leave it open.
If you need to do this type of thing, unwind-protect is your friend. There
is no guarantee that the finalizer will be called when it *must*
be called in order not to run out of file descriptors when you need
something. Unwind-protect is the way to do this type of clean up.
Later,
-pete