Dear all.
I'm trying to create array of threads.
To do it, I describe a class:
Type
TMyThread = class(TThread)
private
protected
procedure Execute; override;
public
start,finish: integer;
Constructor Create(CreateSuspended : boolean);
end;
Each thread should implement simple loop, loop variable goes from 'start' to 'finish'.
So in the main program I'm making the following:
uses
cthreads, cmem, pthreads, //without pthreads debugging is not possible
...
var ThreadsArray: array [1..1500] of TMyThread;
begin
...
for i:=1 to threads do begin
ThreadsArray[i]:=TMyThread.Create(True);
ThreadsArray[i].start:=(i-1)*(Qnum div threads)+1;
ThreadsArray[i].finish:=i*(Qnum div threads);
ThreadsArray[i].Resume;
end;
...
First thread creates fine, but while creating the second (i=2), I get one of two errors:
1) The file events.c was not found. Do you want to locate it yourself?
or
2)Project raised exception class 'External: SIGSEGV'
Can You help me?
Maybe I'm wrong using array of threads. If yes, how can I create a large number of same threads?
Thank You in advance,
Andrey Sapegin.