Empty while loop is worse, for sure: use TThread.WaitFor. You probably want something like this in your TPhysicsMainThread:
Code:threads: array [0..MAX_THREADS-1] of TPhysicsThread; ... stars_per_thread := count div MAX_THREADS; for i := low(threads) to high(threads) do threads[i] := TPhysicsThread.Create(FParent, i * stars_per_thread, (i + 1) * stars_per_thread - 1); for i := low(threads) to high(threads) do begin threads[i].WaitFor; threads[i].Free; end;
Bookmarks