> [program deleted]
>
> So, this basically means that my finalizer did not get run :(
> [...]
> It should run, in separate thread or not, it doesn't matter here.
>
> Any ideas why doesn't it work?

Hopefully the GHC folk will correct me if I'm wrong but I think what happens 
is:

- you allocate object with finalizer
- the object becomes inaccessible
- performGC causes the object to be freed by the garbage collector
- the garbage collector schedules a thread to run your finalizer

BUT

- before the finalizer thread has a chance to be scheduled, your
  program exits.


You could give the finalizer thread a chance to run by calling 
Control.Concurrent.yield before exiting:

  http://etudiants.insia.org/~jbobbio/pafp/docs/base/Control.Concurrent.html#v%
3Ayield

That is, call yield just after calling performGC.

--
Alastair Reid
_______________________________________________
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to