Added R/W mutexes and a corresponding test.