The following message is a courtesy copy of an article that has been posted to comp.lang.misc as well. Yukihiro Matsumoto <matz / netlab.co.jp> writes: > weakref_valid? cannot assure more than validness at the specific moment. > In such race condition, I think you have to rely on exceptions. Agreed. I included it because it was an example of where problems with the GC calls could arise. > I don't want to be under such circumstance where several threads need > to disable GC, which I think should be avoided. Let's discuss about > it. If it is needed, adding nesting count to GC.{enable,disable} is > pretty easy. Well.. I agree that enabling and disabling GC is a pretty ugly thing to do. However, if we _are_ going to do it, then right now it is pretty difficult to do in a multi-threaded environment. If we added the nesting count in the C-code enable/disable calls, it would become trivial. I don't know if backwards-compatibility is an issue. If it is, we could add an extra call, maybe GC.use_nesting, to turn the facility on and off. It isn't a big thing, though. Just an observation, really. Regards Dave