Unexpected scheduling with mutexes