[Lazarus] custom thread reading file does not respond properly

el es el.es.cr at gmail.com
Wed Sep 6 17:25:35 CEST 2017

On 06/09/17 16:19, Sven Barth via Lazarus wrote:
> Am 06.09.2017 16:48 schrieb "el es via Lazarus" <lazarus at lists.lazarus-ide.org <mailto:lazarus at lists.lazarus-ide.org>>:

>> - could the un-yielded code path lead to over-zealous enqueuing of the ShowStatus routine?
>> - if yes, what would happen in such case?
> Both Synchronize and Sleep already causes a thread switch (the former cause it will wait for the main thread to finish processing). Also I already suggested TThread.Yield which is the same as ThreadSwitch.
> And as he wrote the Sleep(1) solves the problem for him.
> It's a pity though that this seems to be necessary on Mac OS X :/
> Regards,
> Sven

It is neccessary in Windows for me too (but i have the opposite problem : the thread-processing can be
a lot shorter - hardware communications - than the time slice of the main thread, giving several Queue()
 or Synchronize() calls as a result;)
Because of that, I have to use a tthreadlist as a buffer between the thread and the main thread.

The time where I was hunting an elusive problem that did not happen under debugger, is never lost ;)


More information about the Lazarus mailing list