W dniu 2024-10-18 o 15:27, Nikolay Nikolov via fpc-devel pisze:

In C (with gcc) it's possible to give them initial value, other than 0:

__thread int i = 5;

But it doesn't seem to be supported by FPC for threadvars. And I don't know about Delphi. FPC's thread initialization does indeed include code for copying the initial values, when creating a thread. Maybe it's for compatibility with thread-aware C libraries (including e.g. glibc), linked with the program, or for a possible future support for initialized threadvars in FPC?

Nikolay

Maybe variables containing managed types, such as dynamic arrays could be a problem in this case?

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

Reply via email to