Add class mutex instead of deprecated static mutex.