Ignore:
Timestamp:
Jan 26, 2011, 8:06:25 AM (14 years ago)
Author:
george
Message:
  • Added: Now multiple thread managers are running within single scheduler.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • MicroThreading/Demo/UMainForm.pas

    r146 r147  
    2828    Label1: TLabel;
    2929    Label2: TLabel;
     30    Label3: TLabel;
     31    Label4: TLabel;
    3032    ListView1: TListView;
    3133    Memo1: TMemo;
    3234    SpinEdit1: TSpinEdit;
     35    SpinEdit2: TSpinEdit;
    3336    Timer1: TTimer;
    3437    procedure Button1Click(Sender: TObject);
     
    8992    Button1.Caption := 'Stop scheduler';
    9093    Memo1.Clear;
     94    Scheduler.ThreadPoolSize := SpinEdit2.Value;
    9195    Scheduler.Start;
    9296  end else begin
    9397    Button1.Caption := 'Start scheduler';
    9498    Scheduler.Stop;
     99    Scheduler.ThreadPoolSize := 0;
    95100  end;
    96101end;
     
    227232var
    228233  I: Integer;
     234  Q: Integer;
    229235const
    230236  TotalSteps = 100;
     
    233239    Memo1.Lines.Add('Worker ' + IntToStr(Id));
    234240    for I := 0 to TotalSteps - 1 do begin
    235       Memo1.Lines.Add(IntToStr(Id) + ': ' + IntToStr(I) + ' ' +
    236         FloatToStr(ExecutionTime));
     241      Q := 0;
     242      while Q < 1000000 do Inc(Q);
     243      //Memo1.Lines.Add(IntToStr(Id) + ': ' + IntToStr(I) + ' ' +
     244      //  FloatToStr(ExecutionTime));
    237245      Completion := I / TotalSteps;
    238246      //Sleep(1 * Id * OneMillisecond);
Note: See TracChangeset for help on using the changeset viewer.