Tasks race with shared variable implemented