[fpc-pascal] Support for "class threadvar" sections inside class and record types
Marco van de Voort
marcov at stack.nl
Sat Jun 23 16:31:35 CEST 2018
In our previous episode, Ryan Joseph said:
> >
> > A threadvar section is started using "class threadvar" and the "class" specifier is required. They are accessed like ordinary class variables with the difference that they'll hold different values per thread - the same as global threadvars after all.
> >
> > This feature is Delphi compatible (and was added, because I noticed that Delphi supported it and FPC did not ??
>
> That?s an interesting idea I wonder how it could be used. Does it do
> anything to help with shared data between threads or is just a way to get
> quick access to thread safe memory?
More probably they needed it for the TMonitor implementation, which is used
as a kind of spinlock in front of every OS synchronization primitive.
More information about the fpc-pascal
mailing list