[Lazarus] custom thread reading file does not respond properly

Andrea Mauri andrea.mauri.75 at gmail.com
Wed Sep 6 11:31:26 CEST 2017


Il 05/09/2017 22:51, Sven Barth via Lazarus ha scritto:
>
> It is however solved if you add a "Yield;" after the Synchronize call.
> So my suspicion is that the scheduling of Mac OS X is somehow messing
> things up. Either the scheduling is favoring the one thread while it
> shouldn't (though even reducing the priority doesn't help) or the UI
> framework of Mac OS X (and whatever else is involved in the main thread)
> is so heavy weight that the timeslice of the mainthread is used up more
> often than not thus leading to the read thread being scheduled much more
> often.
> By using Yield (or also Sleep(), but Yield is without any pause) the
> thread is explicitly giving up its timeslice and that seems to be enough
> here...
>

I changed the code following your hints and I added Yield. This is not 
enough, it seems that the application is a little bit more responding (I 
can click on Tedit and after seconds the text is highlighted) but not 
enough to be usable. Actually for me it works only if I add at least 
Sleep(1).
It is a pity that there is not a unique solution.


More information about the Lazarus mailing list