Use channels instead of mutexes