When StopTheWorld is used to checks for leaks, one thread acquires the
mutex on the thread registry in CheckForLeaks, but a newly spawned thread
accesses the registry in CheckForLeaksCallback. Sharing a mutex access
across threads like this is not supported by blocking mutex,
but is supported by read-only locks in rw mutexes.
In order to allow for read-only access by multiple threads, this patch
changes the lock on the thread registry to a rw mutex.