release Task in a critical section