[fpc-devel] threadvar implementation
sergei_gorelkin at mail.ru
Mon Jul 26 14:51:06 CEST 2010
Michael Schnell wrote:
> This is essentially the same code as with Delphi. Supposedly as with
> Delphi [__tls_index (417328h) ] is always 0 with normal applications.
> (no idea what this is useful for)
The TLS index is allocated by a call to TlsAlloc at application startup. It will be zero for the
first call and increasing for subsequent calls. The subsequent calls are typically done by libraries
that use threadvars. This approach ensures that threadvar blocks of each module in process do not clash.
More information about the fpc-devel