[fpc-devel] Comparison FPC 2.6.2 - Delphi 7
    Michael Schnell 
    mschnell at lumino.de
       
    Mon Mar  4 10:04:24 CET 2013
    
    
  
On 03/04/2013 09:49 AM, Michael Van Canneyt wrote:
>  The solution must work on ALL platforms...
Of course.
I don't remember ever having seen a system (Windows, Linux, x86, ARM, 
NIOS (similar top MIPS) ) where the C compiler does a library call when 
accessing a threadvar. Usually a register is dedicated for this purpose 
that is loaded with a thread specific value by the OS. I do know C 
compiler implementations that don't support threadvars at all and thus 
are unable to support FUTEX and with that low level thread 
synchronization is a lot slower as always a userland/system switch is 
necessary. Here hardware (atomic instructions) and the OS implementation 
(e.g. "Atomic Region" to overcome such limitations for userland) comes 
into play.
I remember from a discussion some years ago that fpc uses a (supposedly 
arch/platform depending) library call with any access to to a threadvar 
instead of using the appropriate (arch/platform depending) register. But 
I did not recheck recently.
-Michael
    
    
More information about the fpc-devel
mailing list