English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Understanding GC and Alarms
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-08-05 (15:04)
From: Björn_Pelzer <bpelzer@u...>
Subject: Re: [Caml-list] Understanding GC and Alarms
Hello Damien!

Damien Doligez wrote:
> Yes, the GC calls the finalisation functions in order, so it waits for your
> finalisation function to finish before starting the next one.  If your
> function doesn't terminate...

Ok, makes sense.

>> Is there a way to get the GC back to normal after an exception during 
>> the alarm?
> That is the purpose of the Gc.finalise_release function: tell the GC to 
> behave
> as if the current finalisation function had finished.  Note that 
> finalise_release
> is also safe to call from outside a finalisation function, so you can 
> call it
> from your exception handler.

Thank you very much! Very helpful, works as you say.
In hindsight I should have figured this out from the manual, but, well, 
I didn't. :-)

> When bug 4742 is fixed (probably in 3.12.0), you won't need it any more.
> Note that I wanted to fix it by ignoring the exception entirely, but
> your use case made me change my mind.

Sounds good, keeping the exception handling would be useful, at least 
for me. Using the release-function as you explained is not much of a 
bother, in particular now that I get how it works, so there is no 
pressing need for a change/bugfix from my side.

Thanks again and best regards,

Björn Pelzer
AGKI - Artificial Intelligence Research Group
University Koblenz-Landau, B 225

Tel.(office): (+49) 261 287 2776
Tel.(home): (+49) 261 942 3908