[fpc-devel] OO rewrite - technical questions

Michael Schnell mschnell at lumino.de
Mon Jul 19 17:07:16 CEST 2010

  On 07/19/2010 03:11 PM, Jonas Maebe wrote:
> That's correct. FPC has largely platform-independent support for threadvars, which is much more heavy-weight than simply using a segment register (indirect procedure call depending on the thread manager, get thread local storage pointer, index local storage with offset specific to the threadvar).
Nonetheless in the end a register is needed to be used that is preloaded 
with different values for different threads. Otherwise a thread can't 
know which one it is. Registers is the only per-Thread information that 
is granted to persist by the OS during preemption.
> There have been attempts to get the segment register approach to work on Windows, but afaik it always crashed on at least one Windows version.

I do know that gcc in Linux on X86  uses a segment register. I don't 
know how gcc works in Windows, but I suppose even Windows is assumed to 
restore all register values of a thread  after a preemption.


More information about the fpc-devel mailing list