Explorar el Código

* disable generic threadvar handling if section thread vars are available

git-svn-id: trunk@40270 -
florian hace 6 años
padre
commit
9c041afc7c
Se han modificado 2 ficheros con 9 adiciones y 1 borrados
  1. 5 1
      rtl/inc/threadvr.inc
  2. 4 0
      rtl/unix/cthreads.pp

+ 5 - 1
rtl/inc/threadvr.inc

@@ -19,7 +19,7 @@
                            Threadvar support
 *****************************************************************************}
 
-
+{$ifndef FPC_SECTION_THREADVARS}
 type
   pltvInitEntry = ^ltvInitEntry;
   ppltvInitEntry = ^pltvInitEntry;
@@ -100,10 +100,12 @@ begin
       copy_unit_threadvars (tables[i]{$ifndef ver3_0}^{$endif});
   end;
 end;
+{$endif FPC_SECTION_THREADVARS}
 
 procedure InitThreadVars(RelocProc : TRelocateThreadVarHandler);
 
 begin
+{$ifndef FPC_SECTION_THREADVARS}
    { initialize threadvars }
    init_all_unit_threadvars;
    { allocate mem for main thread threadvars }
@@ -112,6 +114,8 @@ begin
    copy_all_unit_threadvars;
    { install threadvar handler }
    fpc_threadvar_relocate_proc:=RelocProc;
+{$endif FPC_SECTION_THREADVARS}
+
 {$ifdef FPC_HAS_FEATURE_HEAP}
 {$ifndef HAS_MEMORYMANAGER}
 {$ifndef FPC_NO_DEFAULT_HEAP}

+ 4 - 0
rtl/unix/cthreads.pp

@@ -159,6 +159,7 @@ Type  PINTRTLEvent = ^TINTRTLEvent;
       var
         dataindex : pointer;
       begin
+{$ifndef FPC_SECTION_THREADVARS}
         { we've to allocate the memory from system  }
         { because the FPC heap management uses      }
         { exceptions which use threadvars but       }
@@ -167,6 +168,7 @@ Type  PINTRTLEvent = ^TINTRTLEvent;
         DataIndex:=Pointer(Fpmmap(nil,threadvarblocksize,3,MAP_PRIVATE+MAP_ANONYMOUS,-1,0));
         FillChar(DataIndex^,threadvarblocksize,0);
         pthread_setspecific(tlskey,dataindex);
+{$endif FPC_SECTION_THREADVARS}
       end;
 
 
@@ -321,7 +323,9 @@ Type  PINTRTLEvent = ^TINTRTLEvent;
       begin
         { We're still running in single thread mode, setup the TLS }
         pthread_key_create(@TLSKey,nil);
+{$ifndef FPC_SECTION_THREADVARS}
         InitThreadVars(@CRelocateThreadvar);
+{$endif FPC_SECTION_THREADVARS}
         { used to clean up threads that we did not create ourselves:
            a) the default value for a key (and hence also this one) in
               new threads is NULL, and if it's still like that when the