Re: [Lazarus] custom thread reading file does not respond properly

2017-09-09 Thread Andrea Mauri via Lazarus
Il 06/09/2017 19:45, Andrea Mauri ha scritto: 2017-09-06 19:34 GMT+02:00 Sven Barth via Lazarus mailto:lazarus@lists.lazarus-ide.org>>: Maybe your file is not suitable? I used a /var/log/messages.log file from one of my Linux computers and with that I can reproduce it with the given

Re: [Lazarus] custom thread reading file does not respond properly

2017-09-06 Thread Andrea Mauri via Lazarus
2017-09-06 19:34 GMT+02:00 Sven Barth via Lazarus < lazarus@lists.lazarus-ide.org>: > Maybe your file is not suitable? I used a /var/log/messages.log file from > one of my Linux computers and with that I can reproduce it with the given > code. > > Regards, > Sven > > > They are plain text file. At

Re: [Lazarus] custom thread reading file does not respond properly

2017-09-06 Thread Sven Barth via Lazarus
Am 06.09.2017 17:36 schrieb "Mattias Gaertner via Lazarus" < lazarus@lists.lazarus-ide.org>: > > On Wed, 6 Sep 2017 17:19:28 +0200 > Sven Barth via Lazarus wrote: > > >[...] > > Both Synchronize and Sleep already causes a thread switch (the former cause > > it will wait for the main thread to fini

Re: [Lazarus] custom thread reading file does not respond properly

2017-09-06 Thread Andrea Mauri via Lazarus
Note that his example works on my Mac with or without sleep. Maybe if Andrea posts his full example we may find out more. Mattias Unfortunately I cannot post the real case, it is included in a bigger unit involving other stuffs. Anyway the example I posted is quite the same. In order to bet

Re: [Lazarus] custom thread reading file does not respond properly

2017-09-06 Thread Mattias Gaertner via Lazarus
On Wed, 6 Sep 2017 17:19:28 +0200 Sven Barth via Lazarus wrote: >[...] > 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 wr

Re: [Lazarus] custom thread reading file does not respond properly

2017-09-06 Thread el es via Lazarus
On 06/09/17 16:19, Sven Barth via Lazarus wrote: > Am 06.09.2017 16:48 schrieb "el es via Lazarus" > mailto:lazarus@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 Syn

Re: [Lazarus] custom thread reading file does not respond properly

2017-09-06 Thread Sven Barth via Lazarus
Am 06.09.2017 16:48 schrieb "el es via Lazarus" < lazarus@lists.lazarus-ide.org>: > > On 06/09/17 15:26, el es wrote: > > On 06/09/17 10:31, Andrea Mauri via Lazarus wrote: > >> Il 05/09/2017 22:51, Sven Barth via Lazarus ha scritto: > >>> > >>> It is however solved if you add a "Yield;" after the

Re: [Lazarus] custom thread reading file does not respond properly

2017-09-06 Thread Andrea Mauri via Lazarus
2017-09-06 16:26 GMT+02:00 el es via Lazarus : > > 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; >

Re: [Lazarus] custom thread reading file does not respond properly

2017-09-06 Thread el es via Lazarus
On 06/09/17 15:26, el es wrote: > On 06/09/17 10:31, Andrea Mauri via Lazarus wrote: >> 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 >>> messin

Re: [Lazarus] custom thread reading file does not respond properly

2017-09-06 Thread el es via Lazarus
On 06/09/17 10:31, Andrea Mauri via Lazarus wrote: > 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

Re: [Lazarus] custom thread reading file does not respond properly

2017-09-06 Thread Andrea Mauri via Lazarus
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 reducin

Re: [Lazarus] custom thread reading file does not respond properly

2017-09-05 Thread Sven Barth via Lazarus
On 05.09.2017 21:43, Andrea Mauri via Lazarus wrote: > > I notice that multiple people have already told you not to use a > tight loop, and that applies to any OS. > > > > What exactly means tight? Is it something that I could measure in some way? > The sample test I submitted to the fo

Re: [Lazarus] custom thread reading file does not respond properly

2017-09-05 Thread Andrea Mauri via Lazarus
> I notice that multiple people have already told you not to use a tight > loop, and that applies to any OS. > > > What exactly means tight? Is it something that I could measure in some way? The sample test I submitted to the forum is not my real code, that is a little more complex, and it does any

Re: [Lazarus] custom thread reading file does not respond properly

2017-09-05 Thread Mark Morgan Lloyd via Lazarus
On 05/09/17 13:00, Andrea Mauri via Lazarus wrote: Dear all, I have an issue using threads on OSX.Basically I have a thread reading a file and looking for a string match.I have no problem on win and linux but on osx my thread updates the form but my application does not respond.I opened a topi

[Lazarus] custom thread reading file does not respond properly

2017-09-05 Thread Andrea Mauri via Lazarus
Dear all, I have an issue using threads on OSX. Basically I have a thread reading a file and looking for a string match. I have no problem on win and linux but on osx my thread updates the form but my application does not respond. I opened a topic on the forum (https://forum.lazarus.freepascal.