pspp-dev
[Top][All Lists]
Advanced

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

Re: file-handles


From: Ben Pfaff
Subject: Re: file-handles
Date: Sun, 22 Jan 2006 10:12:07 -0800
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux)

John Darrington <address@hidden> writes:

> On Sat, Jan 21, 2006 at 09:24:10PM -0800, Ben Pfaff wrote:
>      John Darrington <address@hidden> writes:
>      
>      > I noticed that you made some changes to file-handle-def.[ch]
>      > I was wondering why there's no longer a destroy_file_handle function
>      > or equivalent.
>      
>      Because file handles last as long as the PSPP process.  There's
>      no way to destroy them.
>      
>      Is there some reason that you need to destroy them early?  Can
>      you explain?
>
>
> In the gui, every time somebody clicks on file->open, I was destroying
> the file handle, and creating a new one.  A user could click on the
> file->open button an infinite number of times during the operation of
> the gui.  So if there's no way to destroy a file handle, then at least
> I need a way to reuse an existing one.  Ie, with a fh_set_new_filename
> method or similar.

The only real concern I have with reintroducing a destruction
function is the possibility of freeing an in-use file handle.  In
syntax:

        FILE HANDLE FOO...
        DATA LIST (or another command using FOO)
        ...somehow FOO gets destroyed...
        EXECUTE

The EXECUTE will actually run the DATA LIST, at which time FOO
will be dereferenced despite having been destroyed.  That's one
reason there's no DESTROY FILE HANDLE command.  Now if there's no
possibility that the GUI will do that, then it makes sense to let
the GUI destroy its file handle.

I'm actually working on a reference-counting scheme that will
allow destroying file handles safely, but if your code is
destruction-safe then feel free to reintroduce a "free" function
for now.
-- 
Ben Pfaff 
email: address@hidden
web: http://benpfaff.org




reply via email to

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