Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program test5;
- {$mode objfpc}{$H+}
- uses
- cthreads, sysutils;
- var
- t_count: word;
- counter: longword = 0;
- function MyFunc (p: pointer): ptrint;
- var
- i,j:word;
- begin
- i:=Random(16)+1;
- for J:=0 to I do begin
- writeLn('Thread #',integer(p),'/',j);
- end;
- InterLockedIncrement(counter);
- MyFunc:=0;
- end;
- var
- i:word;
- begin
- Randomize;
- t_count:=1024;
- for i:=1 to t_count do BeginThread(@MyFunc, pointer(i));
- while Counter<T_count do;
- WriteLn('Job is done');
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement