[fpc-pascal] Threadvar member field

Michael Van Canneyt michael at freepascal.org
Thu Mar 16 19:57:16 CET 2017



On Thu, 16 Mar 2017, African Wild Dog wrote:

> I have a class where its instances are shared between multiple threads.
> How can I declare one variable per instance per thread?
>
> The code below does not compile (fpc 3.0.0):
>
> TMyClass = class
> public
>  threadvar MyValue: Integer;
> end;

This is not foreseen as a language construct, you must do this yourself.

Michael.



More information about the fpc-pascal mailing list