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

View File

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