Transaction mémoire isolée (parallel)
Un transaction mémoire par exécuteur :
//Procedure doProcess(inst:WFClasseA);
var inst:WFClasseA;
begin
// One separate transaction
// Use private to allocate a new transaction in a new context
withP private Transaction do
begin
inst.unCode := 'X'+inttostr(index);
inst.Caption := 'Objet A'+inttostr(index);
inst.unEntier := 1+Trunc(Random(100));
end;
end;
//Procedure ProcessSomeA(AList:WFClasseAList);
var tk:Int64;
begin
tk := GetTickCount;
try
foreachP var inst in AList do
begin
parallel dProcess(inst);
end;
finally
tk := GetTickCount-tk;
showmessage(Format('%s ms',[TickToString(tk)]));
end;
end;