From ripley at stats.ox.ac.uk  Sun Apr 15 21:09:56 2007
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Sun, 15 Apr 2007 20:09:56 +0100 (BST)
Subject: [Rd] save() and interrupts
In-Reply-To: <59d7961d0704151101w2e892a98r81038a7a336a2ec1@mail.gmail.com>
References: <59d7961d0704151101w2e892a98r81038a7a336a2ec1@mail.gmail.com>
Message-ID: <Pine.LNX.4.64.0704151945120.11794@gannet.stats.ox.ac.uk>

On Sun, 15 Apr 2007, Henrik Bengtsson wrote:

> are there any (cross-platform) specs on what the saved filed is if
> save() is interrupted, e.g. by a user interrupt?   It could be
> non-existing, empty, partly written, or completed.

My understanding is that you cannot user interrupt compiled code unless it 
is set up to check interrupts.  Version 2 saves are done via the internal 
saveToConn, and I don't see any calls to R_CheckUserInterrupt there. So 
you only need to worry about user interrupts in the R code, and that has 
an on.exit action to close the connection (which should be executed even 
if you interrupt).  Which suggests that the file will be

non-existent
empty
complete

and the first two depend on interrupting in the millisecond or less before 
the compiled code gets called.

For other forms of interrupts, e.g. a Unix kill -9, the file state could 
be anything.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] save() and interrupts
Prof Brian Ripley