Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Modula 3 > Re: Can a WeakR...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 3 Topic 94 of 149
Post > Topic >>

Re: Can a WeakRef be overseen?

by Olaf Wagner <wagner@[EMAIL PROTECTED] > Apr 14, 2004 at 12:33 AM

Henning Thielemann wrote:
> I have added some debug output to the wrapper
> 
> PROCEDURE CleanupPlan (<* UNUSED *> READONLY w: WeakRef.T; r: REFANY) =
>   BEGIN
>     IO.Put("Cleanup_Plan\n");
>     FFTWLongRealRaw.DestroyPlan(NARROW(r, Plan)^);
>   END CleanupPlan;
> 
> that I use as a cleanup procedure for a WeakRef:
> 
>   ...
>     plan^ := FFTWLongRealRaw.PlanDFT1D(n, in[0], out[0],
dirToSign[sign],
>                                        LOOPHOLE(flags, C.unsigned_int));
>     EVAL WeakRef.FromRef(plan, CleanupPlan);
>     RETURN plan;
>   ...
> 
> Suprisingly the "Cleanup_Plan" won't be printed in most cases.  I use
only
> short test programs that some computations and then quit immediately.
Does
> the result mean that the wrapper wasn't called or does it mean that the
> output of the text failed? 
The CleanupPlan procedure will be executed when the garbage collector
detects that `plan' is no more reachable. Perhaps a call to
RTCollector.Collect() with the specified semantics of
`Maybe collect now' :-) will improve the behaviour.

Olaf
 




 3 Posts in Topic:
Can a WeakRef be overseen?
Henning Thielemann <ia  2004-04-13 15:57:10 
Re: Can a WeakRef be overseen?
Olaf Wagner <wagner@[E  2004-04-14 00:33:23 
Re: Can a WeakRef be overseen?
"Rodney M. Bates&quo  2004-04-14 16:25:54 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 23:54:05 CDT 2008.