add multithread and lock mechanism