optimize the task pop in working thread by pop all available tasks at a time.