[fpc-pascal] Threadvar member field

Michael Schnell mschnell at lumino.de
Fri Mar 17 09:50:17 CET 2017


On 16.03.2017 19:38, 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?
Does this really make sense ?

Accessing threadvars (in fpc) costs a lot more CPU cycles (i.e. involves 
an OS call) than accessing normal variables.

Supposedly the way to go is to do per-thread instances of a class, that 
might reference the other classes you want to instantiate.

-Michael




More information about the fpc-pascal mailing list