[Top][All Lists]

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

Re: Callbacks in procedure.c

From: Ben Pfaff
Subject: Re: Callbacks in procedure.c
Date: Thu, 07 Jun 2007 22:18:09 -0700
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

John Darrington <address@hidden> writes:

> But that's largely a guess, since I'm not entirely sure what
> proc_commit does, nor what the states PROC_{OPEN,CLOSED,COMMITTED}
> actually mean.
> Ben, do you have the time to write a brief explaination?

PROC_COMMITTED: no procedure is in progress and the active file
is not being read.

PROC_OPEN: proc_open() has been called to obtain a casereader for
the active file and that casereader has not been closed.

PROC_CLOSED: the casereader obtained from proc_open() has been
closed with casereader_destroy(), but the procedure is not
complete because proc_commit() has not been called.

        PROC_COMMITTED -> PROC_OPEN via proc_open.
        PROC_OPEN -> PROC_CLOSED via casereader_destroy on the
                casereader returned by proc_open.
        PROC_CLOSED -> PROC_COMMITTED via proc_commit.
        No other transitions are allowed.

An early draft didn't have the CLOSED state, so that destroying
the casereader from proc_open committed the procedure, but this
was too difficult to deal with because quite often there was no
natural connection between destroying the casereader and
committing the procedure.
"Premature optimization is the root of all evil."
--D. E. Knuth, "Structured Programming with go to Statements"

reply via email to

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