1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
{%skiptarget=$nothread }
program tthread1;
{$mode objfpc}
uses
{$ifdef unix}
cthreads,
{$endif}
Classes;
type
TTestThread = class(TThread)
protected
procedure Execute; override;
public
property ReturnValue;
end;
procedure TTestThread.Execute;
var
thrd: TThread;
begin
thrd := CurrentThread;
if thrd <> Self then
ReturnValue := 1
else
ReturnValue := 0;
end;
var
t: TTestThread;
begin
t := TTestThread.Create(False);
try
t.WaitFor;
ExitCode := t.ReturnValue;
finally
t.Free;
end;
Writeln(ExitCode);
end.
|