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

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to