Added mutex to stdin thread