add lock functions into sample