You're right. But something else I think could happen before my reference fix was that a mutex could loose all its references while inside a cond->wait(mutex_key), thereby destructing the key that should be locked again on exit.
/ Martin Stjernholm, Roxen IS
Previous text:
2002-10-31 21:20: Subject: References to Thread.Mutex
You can't try to lock a mutex without having a reference to it. (Since calling mutex->lock will retain a reference in the frame pointer)
I don't remember if there any reasons for why keys don't reference their mutex, except to facilitate garbage collection. It is however vitally important that mutexes do not have references to the keys, and once I had figured out how to do that I probably just applied that symmetrically.
/ Fredrik (Naranek) Hubinette (Real Build Master)