mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 01:09:35 +02:00

shutting down, that can fail o the test will still fail because the tthread shutdown code itself in the classes unit cannot handle running while a program is quitting, and that should be fixed (exposed by r34456) git-svn-id: trunk@34554 -
42 lines
633 B
ObjectPascal
42 lines
633 B
ObjectPascal
{%skiptarget=$nothread }
|
|
|
|
{$mode objfpc}
|
|
|
|
uses
|
|
{$ifdef unix}
|
|
cthreads,
|
|
{$endif}
|
|
sysutils,
|
|
classes;
|
|
|
|
type
|
|
tmythread = class(tthread)
|
|
fs: ansistring;
|
|
constructor create(const s: ansistring);
|
|
procedure execute; override;
|
|
end;
|
|
|
|
constructor tmythread.create(const s: ansistring);
|
|
begin
|
|
fs:=s+'a';
|
|
freeonterminate:=true;
|
|
inherited create(true);
|
|
end;
|
|
|
|
procedure tmythread.execute;
|
|
begin
|
|
sleep(60);
|
|
// writeln('done');
|
|
end;
|
|
|
|
var
|
|
a: array[1..100] of tmythread;
|
|
i: longint;
|
|
begin
|
|
for i:=low(a) to high(a) do
|
|
a[i]:=tmythread.create('b');
|
|
for i:=low(a) to high(a) do
|
|
a[i].resume;
|
|
sleep(60);
|
|
end.
|