Transaction mémoire partagée (parallel)

De Wiki1000

Une seule transaction mémoire partagée :

<source lang="delphi"> //Procedure doCreateA(index:Integer); var inst:WFClasseA; begin

 // share the transaction
 inst := WFClasseA.Create;
 inst.unCode := 'X'+inttostr(index);
 inst.Caption := 'Objet A'+inttostr(index);
 inst.unEntier := 1+Trunc(Random(100));

end;

//Procedure CreateSomeA; var tk:Int64; begin

 tk := GetTickCount;
 try
 withP Transaction do
 for var idx:=1 to 10 do
  begin
   parallel doCreateA(idx);
  end;
 finally
 tk := GetTickCount-tk;
 showmessage(Format('%s ms',[TickToString(tk)]));
 end;

end; </source>