void Callback(string name, object err = null, object res = null) { if (IsDone) { return; } if (err != null) { taskRoutine.Cancel(); Action <object, Dictionary <string, object> > action = finalFunc.action1; Cleanup(); IsDone = true; IsFree = true; action(err, null); return; } result [name] = res; completeNum++; if (completeNum == total) { Action <object, Dictionary <string, object> > action = finalFunc.action1; Cleanup(); IsDone = true; action(err, null); } else { RunOneFunc(funcs [completeNum] as ChildFunc); } }
void Callback(object err) { if (IsDone) { return; } if (err != null) { taskRoutine.Cancel(); Action <object> action = finalFunc.action2; Cleanup(); IsDone = true; IsFree = true; action(err); return; } completeNum++; if (completeNum == total) { Action <object> action = finalFunc.action2; Cleanup(); IsDone = true; action(err); } else { RunOneFunc(); } }