FreeOnTerminate removed, freeing threads manually now

This commit is contained in:
zueuk 2008-10-06 10:46:49 +00:00
parent 80fbb671e3
commit 4c738a47ed
2 changed files with 13 additions and 7 deletions

View File

@ -31,11 +31,13 @@ type
implementation implementation
//uses SysUtils, FormRender;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
constructor TBucketFillerThread.Create(cp: TControlPoint); constructor TBucketFillerThread.Create(cp: TControlPoint);
begin begin
inherited Create(True); inherited Create(True);
Self.FreeOnTerminate := True; //Self.FreeOnTerminate := True;
Fcp := cp.Clone; Fcp := cp.Clone;
@ -58,6 +60,7 @@ var
bc: integer; bc: integer;
begin begin
inherited; inherited;
//RenderForm.Output.Lines.Add(' . . . > Filler thread #' + IntToStr(ThreadID) + ' Started');
bc := 0; bc := 0;
while (not Terminated) and (bc < Nrbatches) do begin while (not Terminated) and (bc < Nrbatches) do begin
@ -74,6 +77,7 @@ begin
LeaveCriticalSection(CriticalSection); LeaveCriticalSection(CriticalSection);
end; end;
end; end;
//RenderForm.Output.Lines.Add(' . . . > Filler thread #' + IntToStr(ThreadID) + ' Finished');
end; end;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

View File

@ -104,6 +104,8 @@ begin
for i := 0 to High(WorkingThreads) do begin for i := 0 to High(WorkingThreads) do begin
WorkingThreads[i].Terminate; WorkingThreads[i].Terminate;
WorkingThreads[i].WaitFor;
WorkingThreads[i].Free;
end; end;
SetLength(WorkingThreads, 0); SetLength(WorkingThreads, 0);
@ -128,7 +130,7 @@ var
begin begin
for i := 0 to High(WorkingThreads) do for i := 0 to High(WorkingThreads) do
WorkingThreads[i].Terminate; WorkingThreads[i].Terminate;
SetLength(WorkingThreads, 0); //? //SetLength(WorkingThreads, 0); //?
inherited; // FStop := 1; inherited; // FStop := 1;
end; end;
@ -143,7 +145,7 @@ begin
for i := 0 to High(WorkingThreads) do for i := 0 to High(WorkingThreads) do
WorkingThreads[i].Terminate; WorkingThreads[i].Terminate;
SetLength(WorkingThreads, 0); //? //SetLength(WorkingThreads, 0); //?
end; end;
procedure TBaseMTRenderer.Pause; procedure TBaseMTRenderer.Pause;
@ -167,11 +169,11 @@ begin
end; end;
procedure TBaseMTRenderer.SetThreadPriority(p: TThreadPriority); procedure TBaseMTRenderer.SetThreadPriority(p: TThreadPriority);
var //var
i: integer; // i: integer;
begin begin
inherited; inherited;
//for i := 0 to High(WorkingThreads) do //for i := 0 to High(WorkingThreads) do
// WorkingThreads[i].Priority := p; // WorkingThreads[i].Priority := p;
end; end;
@ -181,7 +183,7 @@ function TBaseMTRenderer.NewThread: TBucketFillerThread;
begin begin
Result := TBucketFillerThread.Create(fcp); Result := TBucketFillerThread.Create(fcp);
assert(Result<>nil); assert(Result<>nil);
//Result.Priority := FThreadPriority; Result.Priority := tpLower; //FThreadPriority;
if FCP.FAngle = 0 then if FCP.FAngle = 0 then
Result.AddPointsProc := self.AddPointsToBuckets Result.AddPointsProc := self.AddPointsToBuckets