[fpc-devel] threadvar vs docs
Nikolay Nikolov
nickysn at gmail.com
Fri Oct 18 06:40:03 CEST 2024
On 10/18/24 12:10 AM, Martin Frb via fpc-devel wrote:
> https://wiki.freepascal.org/Threadvar
>> If threads are used then a copy is made for each thread (including
>> the main thread). Note that the copy is made with the original value
>> of the variable, not with the value of the variable at the time the
>> thread is started.
>
> But what is that original value? Since
> threadvar
> foo: integer = 1;
>
> gives
> Error: Cannot initialize variables declared as threadvar
I think the documentation is wrong. Threadvars are always initialized as
zero.
Nikolay
More information about the fpc-devel
mailing list