Re: Callbacks

From: Ulisses (ra993482_at_ic.unicamp.br)
Date: Tue Feb 22 2005 - 07:51:34 PST

  • Next message: Paul H. Hargrove: "Re: BLCR 0.4.0 released"
    On Tue, 2005-02-22 at 16:16 +0100, Michael Klemm wrote:
    > Playing around with BLCR I found that one can only register a callback
    > which will be called whenever a checkpoint is requested. Thus, an
    > application is supposed to be able to shutdown sockets, close files, etc.
    > 
    > I was wondering why there is no "restart" callback which is invoked
    > whenever a checkpoint returns. A closed socket has to be reopened
    > somehow. The easiest way: register a restart callback that is able to
    > re-establish a particular set of sockets, re-open some files, etc.
    > 
    > The only idea (for now) to solve this problem is some kind of global
    > variable that is checked each time a socket connection (or file, ...) is
    > used to be able to re-open the descriptor right before the access
    > occurs... I'm I right?
    
    Michael,
    
    	I think you didn't quite understand what happens when you call
    cr_checkpoint() inside of a callback. You can read about callbacks and
    the cr_checkpoint() function in the file libcr/libcr.h (line 289). What
    you have missed is that on restart-time the callback continues its
    execution after the call to cr_checkpoint(), and you can know your
    program is being restarted by checking the return value of cr_checkpoint
    (). :-)
    
    Best regards,
    
    -- Ulisses
    

  • Next message: Paul H. Hargrove: "Re: BLCR 0.4.0 released"