DelphiBuilder / NetCom7

The fastest communications possible. Delphi rulez.
MIT License
174 stars 43 forks source link

Undefined index variable in RequestReadyThread #4

Closed MauricDaniel closed 4 years ago

MauricDaniel commented 4 years ago

In function TncThreadPool.RequestReadyThread: TncReadyThread

the variable i used for thread index is not defined: Threads[ High(Threads)].Priority := Threads[0].Priority; Threads[i].ReadyEvent.WaitFor(1000);

I guess it's supposed to be High(Threads) instead of i, can you verify that ?

DelphiBuilder commented 4 years ago

Man! You are absolutely right!!! The code was working as variable i was already High(Threads) due to the previous for loop, but since we are talking about Pascal here, the contents of variable i should be considered undefined after a for loop. Thanks so much for spotting this out! What an eye!