private void action(Job job) { var sp = job.GetSavePoint<Tuple<int, int>>(); if (sp == null) sp = new Tuple<int, int>(0, 0); for (int i = sp.Item1; i < 100000; ++i) { SpinWait.SpinUntil(() => { for (int j = sp.Item2; j < 10000; ++j) { job.CancelProcess(nj => new Tuple<int, int>(i, j)); } return true; }); } }