add lock when the task is removed and added
extends some queues' class to solve the Synchronou problem