Use local atomicboolean to check if task is finished