On 18 Sep 2009, at 23:04, Dariusz Mazur wrote:

But is this optimal solution:

procedure SysThreadSwitch;
begin
     Sleep(0);
end;

  WinThreadManager.ThreadSwitch           :=...@systhreadswitch;

procedure ThreadSwitch;
begin
CurrentTM.ThreadSwitch;
end;

We have 2 unnecessary invoke function. Can compiler optimize this? Or maybe better do ThreadSwitch and SysThreadSwitch inlined.

SysThreadSwitch cannot be inlined, because it's called as a procvar. And since you are doing a context switch anyway, the additional overhead of a direct and an indirect call is negligible.


Jonas
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to