// {$mode objfpc}
uses sysutils, cthreads;
const threadcount = 100;
stringlen = 10000;
var finished : longint;
i : longint;
threadvar thri : longint;
function f(p : pointer) : longint;
var s : ansistring;
begin
//writeln('thread ', longint(p) , ' started');
writeln('thread ', ptrint(p) , ' started');
thri := 0;
while (thri < stringlen) do
begin
s := s + '1';
inc(thri);
end;
//writeln('thread ', longint(p), ' finished');
writeln('thread ', ptrint(p), ' finished');
//InterLockedIncrement(finished);
interlockedincrement(finished);
f := 0;
end;
begin
finished := 0;
for i := 1 to threadcount do BeginThread(@f, pointer(i)); <-- line 33
while finished < threadcount do;
writeln(finished);
end.
------------
t.pas(33,46) Error: Illegal type conversion: "LongInt" to "^untyped"
t.pas(38) Fatal: There were 1 errors compiling module, stopping
t.pas(38) Fatal: Compilation aborted
Error: /usr/local/bin/ppcx64 returned an error exitcode (normal if you did not specify a source file to be compiled)