[fpc-devel] threadvar vs docs

Martin Frb lazarus at mfriebe.de
Thu Oct 17 23:10:18 CEST 2024


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


More information about the fpc-devel mailing list