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 <lazarus@lists.lazarus-ide.org> 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 inconsistent >> timing results, when I used Now() both in main thread and in the thread; > > AFAIK Now is thread safe. On what platform and how did you test? > > Mattias > Now() is literally function Now : TDateTime; var ASystemTime : TSYSTEMTIME; begin GetSystemTime(ASystemTime); Result := SystemTimeToDateTime(ASystemTime); end; on my installation (lazarus 1.6.4 #54278, FPC 3.0.2) I'd say it's questionable to say it's thread-safe that way; It may be safe to use in main thread (where no 2 different contexts can mangle each others ASystemTime); ASystemTime is a local variable, so two threads won't influence each other there thus at least on Windows Now() is threadsafe. Regards, Sven
-- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus