Transaction mémoire isolée (parallel)

De Wiki1000
(Différences entre les versions)
Syfre (discuter | contributions)
(Page créée avec « Un transaction mémoire par exécuteur : <source lang="delphi"> //Procedure doProcess(inst:WFClasseA); var inst:WFClasseA; begin // One separate transaction // Use priva… »)
Modification suivante →

Version du 17 octobre 2011 à 09:35

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;




Whos here now:   Members 0   Guests 0   Bots & Crawlers 1
 
Outils personnels