mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-14 15:52:49 +02:00
24 lines
440 B
ObjectPascal
24 lines
440 B
ObjectPascal
program SimpleMTP1;
|
|
|
|
{$mode objfpc}{$H+}
|
|
|
|
uses
|
|
{$IFDEF UNIX}
|
|
cthreads, cmem,
|
|
{$ENDIF}
|
|
MTProcs;
|
|
|
|
// a simple parallel procedure
|
|
procedure DoSomethingParallel(Index: PtrInt; Data: Pointer; Item: TMultiThreadProcItem);
|
|
var
|
|
i: Integer;
|
|
begin
|
|
writeln(Index);
|
|
for i:=1 to Index*1000000 do ; // do some work
|
|
end;
|
|
|
|
begin
|
|
ProcThreadPool.DoParallel(@DoSomethingParallel,1,5,nil); // address, startindex, endindex, optional data
|
|
end.
|
|
|