[fpc-devel] threadvar implementation
Michael Schnell
mschnell at lumino.de
Mon Aug 2 13:15:41 CEST 2010
On 07/30/2010 08:01 PM, Hans-Peter Diettrich wrote:
>
> The only question is, whether you want the (absolute, flat) address of
> the threadvar of an *specific* thread, or the address of the threadvar
> in the *current* thread. Since the current thread can change, the
> offset of the threadvar record will change accordingly, and must be
> determined by the appropriate means (via segment or other address
> register).
>
This is what threadvars are all about,. Of course the effective address
needs to be different for different threads (otherwise this would be
just static/global variables, as the virtual address mapping is defined
to be identical for all threads of an application).
The difference between the systems I checked seems to be that the
non-flat address (disregarding the Selector to be used) (this seems to
be what is stored in a pointer, assuming DS: in FPC) of the threadvars
in different threads is identical with X86/Linux and different with all
other systems. C can handle this by defining the pointer type
appropriately (with "__thread") while FPC does not seem to have this
ability.
-Michael
More information about the fpc-devel
mailing list