Re: [Lazarus] Weird object variables access - fpc issue?

2017-10-24 Thread el es via Lazarus
On 24/10/17 12:59, Mattias Gaertner via Lazarus wrote: > ASystemTime is a stack variable. That's thread-safe. > > In fpc trunk it calls GetLocalTime on Unix, which fetches timezone > every time. No global var. So it should be thread safe. > >> because each thread instance would have its own

Re: [Lazarus] Weird object variables access - fpc issue?

2017-10-24 Thread Sven Barth via Lazarus
Am 24.10.2017 13:41 schrieb "el es via Lazarus" < lazarus@lists.lazarus-ide.org>: On 24/10/17 10:04, Mattias Gaertner via Lazarus wrote: > On Tue, 24 Oct 2017 08:59:36 +0100 > el es via Lazarus wrote: > >> On 23/10/17 20:00, Giuliano Colla via Lazarus wrote: >>

Re: [Lazarus] Weird object variables access - fpc issue?

2017-10-24 Thread Mattias Gaertner via Lazarus
On Tue, 24 Oct 2017 12:41:11 +0100 el es via Lazarus wrote: >[...] > Now() is literally > > function Now : TDateTime; > var ASystemTime : TSYSTEMTIME; > begin >GetSystemTime(ASystemTime); >Result := SystemTimeToDateTime(ASystemTime); > end; > > on my

Re: [Lazarus] Weird object variables access - fpc issue?

2017-10-24 Thread el es via Lazarus
On 24/10/17 10:04, Mattias Gaertner via Lazarus wrote: > On Tue, 24 Oct 2017 08:59:36 +0100 > el es via Lazarus wrote: > >> On 23/10/17 20:00, Giuliano Colla via Lazarus wrote: >> [snip] >> >> I don't remember if I was hitting AV using Now(), likely I wasn't - >>

Re: [Lazarus] Weird object variables access - fpc issue?

2017-10-24 Thread el es via Lazarus
On 24/10/17 10:20, Michael Schnell via Lazarus wrote: > On 24.10.2017 10:48, el es via Lazarus wrote: >> [...] begin    repeat    until not ThreadNowInUse;  //       try ThreadNowInUse :=true; >>> > Busy wait actions are usually a very bad idea > > Better use a

Re: [Lazarus] Weird object variables access - fpc issue?

2017-10-24 Thread Michael Van Canneyt via Lazarus
On Tue, 24 Oct 2017, Mattias Gaertner via Lazarus wrote: On Tue, 24 Oct 2017 11:11:15 +0200 (CEST) Michael Van Canneyt via Lazarus wrote: [...] From memory: The first call to Now is not necessarily thread-safe, because of the initialization of TZ info ?

Re: [Lazarus] Weird object variables access - fpc issue?

2017-10-24 Thread Mattias Gaertner via Lazarus
On Tue, 24 Oct 2017 11:11:15 +0200 (CEST) Michael Van Canneyt via Lazarus wrote: >[...] > From memory: > The first call to Now is not necessarily thread-safe, because of the > initialization of TZ info ? Please add this to the docs. Mattias --

Re: [Lazarus] Weird object variables access - fpc issue?

2017-10-24 Thread Michael Schnell via Lazarus
On 24.10.2017 11:29, Mattias Gaertner via Lazarus wrote: Are you kidding? If this is not appropriate, I suppose the general design of that functionality should be reconsidered, doing anything that needs a fast reaction in the worker thread. -Michael --

Re: [Lazarus] Weird object variables access - fpc issue?

2017-10-24 Thread Mattias Gaertner via Lazarus
On Tue, 24 Oct 2017 11:20:50 +0200 Michael Schnell via Lazarus wrote: > On 24.10.2017 10:48, el es via Lazarus wrote: > > [...] > >>> begin > >>>repeat > >>>until not ThreadNowInUse; // > >>> > >>>try > >>> ThreadNowInUse :=true; > >>

Re: [Lazarus] Weird object variables access - fpc issue?

2017-10-24 Thread Michael Schnell via Lazarus
On 24.10.2017 10:48, el es via Lazarus wrote: [...] begin repeat until not ThreadNowInUse; // try ThreadNowInUse :=true; Busy wait actions are usually a very bad idea Better use a TTimer for such. -Michael -- ___ Lazarus

Re: [Lazarus] Weird object variables access - fpc issue?

2017-10-24 Thread Michael Van Canneyt via Lazarus
On Tue, 24 Oct 2017, Mattias Gaertner via Lazarus wrote: On Tue, 24 Oct 2017 08:59:36 +0100 el es via Lazarus wrote: On 23/10/17 20:00, Giuliano Colla via Lazarus wrote: [snip] I don't remember if I was hitting AV using Now(), likely I wasn't - but due to

Re: [Lazarus] Weird object variables access - fpc issue?

2017-10-24 Thread Mattias Gaertner via Lazarus
On Tue, 24 Oct 2017 08:59:36 +0100 el es via Lazarus wrote: > On 23/10/17 20:00, Giuliano Colla via Lazarus wrote: > [snip] > > I don't remember if I was hitting AV using Now(), likely I wasn't - > but due to 'normal' Now() being not thread safe, I was getting

Re: [Lazarus] Weird object variables access - fpc issue?

2017-10-24 Thread Sven Barth via Lazarus
Am 24.10.2017 10:49 schrieb "el es via Lazarus" < lazarus@lists.lazarus-ide.org>: On 24/10/17 09:11, Mattias Gaertner via Lazarus wrote: > On Tue, 24 Oct 2017 08:59:36 +0100 > el es via Lazarus wrote: > >> [...] >> begin >> repeat >> until not ThreadNowInUse;

Re: [Lazarus] Weird object variables access - fpc issue?

2017-10-24 Thread el es via Lazarus
On 24/10/17 09:11, Mattias Gaertner via Lazarus wrote: > On Tue, 24 Oct 2017 08:59:36 +0100 > el es via Lazarus wrote: > >> [...] >> begin >> repeat >> until not ThreadNowInUse; // >> >> try >> ThreadNowInUse :=true; > > This is not thread safe. >

Re: [Lazarus] Weird object variables access - fpc issue?

2017-10-24 Thread Mattias Gaertner via Lazarus
On Tue, 24 Oct 2017 08:59:36 +0100 el es via Lazarus wrote: >[...] > begin > repeat > until not ThreadNowInUse; // > > try > ThreadNowInUse :=true; This is not thread safe. Mattias -- ___ Lazarus mailing

Re: [Lazarus] Weird object variables access - fpc issue?

2017-10-24 Thread el es via Lazarus
On 23/10/17 20:00, Giuliano Colla via Lazarus wrote: [snip] I don't remember if I was hitting AV using Now(), likely I wasn't - but due to 'normal' Now() being not thread safe, I was getting inconsistent timing results, when I used Now() both in main thread and in the thread; So with my

Re: [Lazarus] Weird object variables access - fpc issue?

2017-10-23 Thread Mattias Gaertner via Lazarus
On Mon, 23 Oct 2017 22:50:49 +0200 Giuliano Colla via Lazarus wrote: > Il 23/10/2017 21:33, Sven Barth via Lazarus ha scritto: > > How do you pass the SendMessage() method to your thread? And how does > > the code look that calls it? > > > The SendMessage()

Re: [Lazarus] Weird object variables access - fpc issue?

2017-10-23 Thread Giuliano Colla via Lazarus
Il 23/10/2017 21:33, Sven Barth via Lazarus ha scritto: How do you pass the SendMessage() method to your thread? And how does the code look that calls it? The SendMessage() method belongs to the main thread only, and is supposed to execute only in the main thread context. It fills up a

Re: [Lazarus] Weird object variables access - fpc issue?

2017-10-23 Thread Sven Barth via Lazarus
Am 23.10.2017 21:00 schrieb "Giuliano Colla via Lazarus" < lazarus@lists.lazarus-ide.org>: I'm doing something wrong, I'm missing something, or this is just a compiler bug? How do you pass the SendMessage() method to your thread? And how does the code look that calls it? Regards, Sven --

[Lazarus] Weird object variables access - fpc issue?

2017-10-23 Thread Giuliano Colla via Lazarus
I have stumbled into what appears to me to be a compiler error, but before I post in the fpc list, I'd like to get expert advice. I have an application already in use since many years, which uses a thread to handle a serial line. I don't know if that second thread