Changeset 153 for MicroThreading/UMicroThreading.pas
- Timestamp:
- Jan 27, 2011, 10:56:06 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
MicroThreading/UMicroThreading.pas
r152 r153 69 69 procedure Resume; 70 70 procedure Suspend; 71 procedure Synchronize(AMethod: TThreadMethod); 71 72 72 73 constructor Create(CreateSuspended: Boolean; … … 118 119 FCurrentMicroThread: TMicroThread; 119 120 FScheduler: TMicroThreadScheduler; 121 FThread: TMicroThreadThread; 120 122 function Execute(Count: Integer): Integer; 121 123 public 122 124 Id: Integer; 123 125 procedure Yield; 126 procedure Synchronize(AMethod: TThreadMethod); 124 127 constructor Create; 125 128 destructor Destroy; override; … … 332 335 end; 333 336 337 procedure TMicroThreadManager.Synchronize(AMethod: TThreadMethod); 338 begin 339 if Assigned(FThread) then 340 FThread.Synchronize(FThread, AMethod); 341 end; 342 334 343 constructor TMicroThreadManager.Create; 335 344 begin 336 345 FCurrentMicroThread := nil; 346 FThread := nil; 337 347 end; 338 348 … … 487 497 FSuspended := True; 488 498 //Yield; 499 end; 500 501 procedure TMicroThread.Synchronize(AMethod: TThreadMethod); 502 begin 503 FManager.Synchronize(AMethod); 489 504 end; 490 505 … … 538 553 FMainThreadManager.Free; 539 554 FThreadPool.Free; 555 FThreadPoolLock.Free; 540 556 FMicroThreads.Free; 541 557 FMicroThreadsLock.Free; … … 548 564 UpdateThreadPoolSize; 549 565 FState := ssRunning; 566 if FUseMainThread then 567 FMainThreadStarter.Enabled := True; 550 568 end; 551 569 … … 599 617 NewThread := TMicroThreadThread.Create(True); 600 618 NewThread.Manager.FScheduler := Self; 601 NewThread.Manager.Id := FThreadPool.Count; 619 NewThread.Manager.Id := FThreadPool.Count + 1; 620 NewThread.Manager.FThread := NewThread; 602 621 NewThread.OnTerminate := PoolThreadTerminated; 603 622 ThreadPool.Add(NewThread);
Note:
See TracChangeset
for help on using the changeset viewer.