Ignore:
Timestamp:
Jan 27, 2011, 10:30:55 AM (14 years ago)
Author:
george
Message:
  • Fixed: Wrong context restoration after return from micro thread.
  • Add: Option of TMicroThreadScheduler to set use or not use main thread for scheduling.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • MicroThreading/Demo/UMainForm.pas

    r151 r152  
    2121    ButtonSchedulerStartStop: TButton;
    2222    ButtonShowThreadId: TButton;
     23    CheckBoxUseMainThread: TCheckBox;
    2324    GroupBox1: TGroupBox;
    2425    GroupBox2: TGroupBox;
     
    5354    procedure ButtonShowThreadIdClick(Sender: TObject);
    5455    procedure ButtonClearMicroThreadsClick(Sender: TObject);
     56    procedure CheckBoxUseMainThreadChange(Sender: TObject);
    5557    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    5658    procedure FormCreate(Sender: TObject);
     
    165167begin
    166168  //Scheduler.FMicroThreads.Clear;
    167   for I := 0 to SpinEdit1.Value do
     169  for I := 0 to SpinEdit1.Value - 1 do
    168170    Scheduler.AddMethod(Worker);
    169171end;
     
    199201    Scheduler.MicroThreadsLock.Release;
    200202  end;
     203end;
     204
     205procedure TMainForm.CheckBoxUseMainThreadChange(Sender: TObject);
     206begin
     207  Scheduler.UseMainThread := CheckBoxUseMainThread.Checked;
    201208end;
    202209
Note: See TracChangeset for help on using the changeset viewer.