Ignore:
Timestamp:
Jan 26, 2011, 7:28:29 AM (13 years ago)
Author:
george
Message:
  • Fixed: Freeing micro threads on finish.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • MicroThreading/Demo/UMainForm.pas

    r145 r146  
    208208      Item.SubItems.Add(MicroThreadStateText[State]);
    209209      Item.SubItems.Add(FloatToStr(ExecutionTime));
     210      Item.SubItems.Add(IntToStr(Trunc(Completion * 100)) + '%');
    210211    end;
    211212  finally
     
    226227var
    227228  I: Integer;
     229const
     230  TotalSteps = 100;
    228231begin
    229232  with MicroThread do begin
    230233    Memo1.Lines.Add('Worker ' + IntToStr(Id));
    231     for I := 0 to 1000 do begin
     234    for I := 0 to TotalSteps - 1 do begin
    232235      Memo1.Lines.Add(IntToStr(Id) + ': ' + IntToStr(I) + ' ' +
    233236        FloatToStr(ExecutionTime));
     237      Completion := I / TotalSteps;
    234238      //Sleep(1 * Id * OneMillisecond);
    235239      Yield;
Note: See TracChangeset for help on using the changeset viewer.