Changeset 156 for MicroThreading/Demo/UMainForm.pas
- Timestamp:
- Jan 28, 2011, 2:12:42 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
MicroThreading/Demo/UMainForm.pas
r155 r156 46 46 TabSheet3: TTabSheet; 47 47 TimerRedraw: TTimer; 48 TimerSchedulerStart: TTimer;49 48 procedure Button1Click(Sender: TObject); 50 49 procedure ButtonSchedulerStartStopClick(Sender: TObject); … … 62 61 procedure SpinEdit3Change(Sender: TObject); 63 62 procedure TimerRedrawTimer(Sender: TObject); 64 procedure TimerSchedulerStartTimer(Sender: TObject);65 63 private 66 64 procedure Worker(MicroThread: TMicroThread); … … 215 213 begin 216 214 Iterations := SpinEdit3.Value; 215 SpinEdit2.Value := 20; 216 ButtonAddWorkers.Click; 217 ButtonSchedulerStartStop.Click; 217 218 end; 218 219 … … 224 225 with TMicroThread(MainScheduler.MicroThreads[Item.Index]) do begin 225 226 Item.Caption := IntToStr(Id); 226 Item.SubItems.Add(Name);227 227 Item.SubItems.Add(''); 228 228 Item.SubItems.Add(IntToStr(Priority)); … … 230 230 Item.SubItems.Add(MicroThreadBlockStateText[BlockState]); 231 231 Item.SubItems.Add(FloatToStr(ExecutionTime)); 232 Item.SubItems.Add(IntToStr(ExecutionCount)); 232 233 Item.SubItems.Add(IntToStr(Trunc(Completion * 100)) + '%'); 233 234 Item.SubItems.Add(IntToStr(StackUsed)); 235 Item.SubItems.Add(Name); 234 236 end; 235 237 finally … … 260 262 end; 261 263 262 procedure TMainForm.TimerSchedulerStartTimer(Sender: TObject);263 begin264 TimerSchedulerStart.Enabled := False;265 ButtonAddWorkers.Click;266 ButtonSchedulerStartStop.Click;267 end;268 269 264 procedure TMainForm.WorkerSubRoutine; 270 265 begin 271 MTSleep(1 * OneMillisecond);266 //MTSleep(1 * OneMillisecond); 272 267 end; 273 268 … … 282 277 Q := 0; 283 278 while Q < 100 do Inc(Q); 284 Synchronize(WorkerDoWrite);279 //Synchronize(WorkerDoWrite); 285 280 //Memo1.Lines.Add(IntToStr(Id) + ': ' + IntToStr(I) + ' ' + 286 281 // FloatToStr(ExecutionTime)); 287 282 Completion := I / Iterations; 288 //MTSleep(1 * Id* OneMillisecond);283 //MTSleep(1000 * OneMillisecond); 289 284 Yield; 290 WorkerSubRoutine;285 //WorkerSubRoutine; 291 286 end; 292 287 end; … … 295 290 procedure TMainForm.WorkerDoWrite; 296 291 begin 297 Memo1.Lines.Add('.');292 //Memo1.Lines.Add('.'); 298 293 end; 299 294
Note:
See TracChangeset
for help on using the changeset viewer.