Create Thread Limit
Original Reporter info from Mantis: biose
-
Reporter name: Lionel
Original Reporter info from Mantis: biose
- Reporter name: Lionel
Description:
Hello, there is thread creation limit on linux, i don't try under win32 environment.
With Kylix compiler, no problem.
Additional information:
Very simple sample :
program test_thread;
{$IFDEF FPC}
{$PACKRECORDS C}
{$MODE DELPHI} // Delphi-compatible mode in FreePascal
{$ASMMODE Intel}
{$UNDEF BORLAND}
{$ELSE}
{$APPTYPE CONSOLE}
{$ENDIF}
uses
{$IFDEF FPC}
cthreads,
{$ENDIF}
SysUtils,
Classes;
type
TTestThread = class(TThread)
private
{ Déclarations privées }
protected
procedure Execute; override;
end;
const
MAX_THREAD : integer = 1000;
var
I : integer;
{ TTestThread }
procedure TTestThread.Execute;
begin
Writeln('[' + IntToStr(Self.ThreadID) + '] Running...');
Terminate;
end;
procedure CreateThread;
var
TestThread : TTestThread;
begin
TestThread := TTestThread.Create(true);
TestThread.FreeOnTerminate := true;
TestThread.Resume;
end;
begin
try
for I := 1 to MAX_THREAD do
begin
Writeln('Create ' + IntToStr(I) + ' ...');
CreateThread;
Sleep(100);
end;
Writeln('Finish');
ReadLn;
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
end.
Mantis conversion info:
- Mantis ID: 9016
- Version: 2.3.1
- Fixed in version: 2.2.2
- Fixed in revision: 8430 (#30014fb6)
- Monitored by: » biose (Lionel)