2017-09-06 16:26 GMT+02:00 el es via Lazarus <[email protected]> :
> > Can you try ThreadSwitch after Sleep ? > > while (not Terminated) do > begin > if eof(f) then > reset(f); > ReadLn(f, newStatus); > if NewStatus <> fStatusText then > begin > fStatusText := newStatus; > //Queue(@ShowStatus); > Synchronize(@Showstatus); > Sleep(5); > ThreadSwitch; /// <<<< > end > else // also you need to cover what happens in ANY OTHER outcome of > any test, e.g. > ThreadSwitch; > // because if NewStatus = fStatusText, you will IMMEDIATELY jump to > the first instruction of the thread > // so adding the ThreadSwitch at the very end of the loop, you give > the rest of the application (the main thread) a chance to > // actually do anything > end; > > Thread.Execute will execute ALL THE TIME if you don't yield/threadswitch > in some code path, and WILL saturate your CPU. > > Actually using sleep(1) I can interact with my application. ThreadSwitch does not introduce any change. If I use sleep(1) it works, if I don't use it but I use Yield or ThreadSwitch I cannot interact with my application.
-- _______________________________________________ Lazarus mailing list [email protected] https://lists.lazarus-ide.org/listinfo/lazarus
