[Lazarus] Weird object variables access - fpc issue?
Sven Barth
pascaldragon at googlemail.com
Tue Oct 24 14:06:09 CEST 2017
Am 24.10.2017 13:41 schrieb "el es via Lazarus" <
lazarus at 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 at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20171024/faed2c93/attachment.html>
More information about the Lazarus
mailing list