migration from task to thread API