[MLton] adding synchronous finalizers
   
    Henry Cejtin
     
    henry@sourcelight.com
       
    Wed, 29 Sep 2004 16:25:15 -0500
    
    
  
I have down-loaded the paper, but haven't read it yet.  I'm impressed that he
agrees with so many of our thoughts.
The idea of a single-threaded program manually clearing out finalizers sounds
good, but do we really want this to be a run-time or a compile-time decision.
Perhaps I am thinking too much about the optimizations we lose when  multiple
threads  exist, but I would think that the distinction between multi-threaded
and single-threaded is almost certainly going to be known  at  compile  time.
Hence it should be set by a compile-time flag.
Speaking  of  finalizers,  I  would think that the exact same arguments would
apply to signals.
I.e., what we really want is a  flag  (indicating  now  signal  checking  nor
finalization  running  automatically)  and  a single function, something link
MLton.poll of type unit -> unit which runs any finalizers  waiting  and  also
handles any pending signals.