Added mutex lock/unlock.