From: David Masover Date: 2008-09-15T05:33:31+09:00 Subject: Re: Garbage collecting threads? On Sunday 14 September 2008 15:22:53 Robert Klemme wrote: > There is no hook in Ruby that is called when the scope of a variable > ends. An object without any references can be garbage collected. But a > finalizer won't work because then the object is gone already. What is a "finalizer" in this context? > Also, the > queue that connects farmer and workers will still have references even > if the farmer is gone, so the finalizer will never be called... Is it possible to have weak references in Ruby? > > So, it sounds like you're telling me all the "usual" ways of doing this. > > What's wrong with using the usual ways? The usual ways still force me to explicitly clean up after my worker threads. This is irritating, philosophically -- if I wanted to do manual resource management, I'd write C++, not Ruby. It also means that if I'm implementing any kind of library on top of that, I have to force all my users to do the same manual cleanup.