Browse Source

o patch from Sven Barth:
- remove critical section from dll initialization, windows allows only one thread at one to run dllmain, resolves #17858

git-svn-id: trunk@16263 -

florian 14 years ago
parent
commit
27ff441975
2 changed files with 0 additions and 5 deletions
  1. 0 1
      rtl/win/systhrd.inc
  2. 0 4
      rtl/win/syswin.inc

+ 0 - 1
rtl/win/systhrd.inc

@@ -92,7 +92,6 @@ CONST
       TLSKey : DWord = $ffffffff;
       TLSKey : DWord = $ffffffff;
     var
     var
       MainThreadIdWin32 : DWORD;
       MainThreadIdWin32 : DWORD;
-      AttachingThread : TRTLCriticalSection;
 
 
     procedure SysInitThreadvar(var offset : dword;size : dword);
     procedure SysInitThreadvar(var offset : dword;size : dword);
       begin
       begin

+ 0 - 4
rtl/win/syswin.inc

@@ -34,7 +34,6 @@ function Dll_entry{$ifdef FPC_HAS_INDIRECT_MAIN_INFORMATION}(const info : TEntry
      case DLLreason of
      case DLLreason of
        DLL_PROCESS_ATTACH :
        DLL_PROCESS_ATTACH :
          begin
          begin
-           WinInitCriticalSection(AttachingThread);
            MainThreadIdWin32 := Win32GetCurrentThreadId;
            MainThreadIdWin32 := Win32GetCurrentThreadId;
 
 
            If SetJmp(DLLBuf) = 0 then
            If SetJmp(DLLBuf) = 0 then
@@ -53,7 +52,6 @@ function Dll_entry{$ifdef FPC_HAS_INDIRECT_MAIN_INFORMATION}(const info : TEntry
          begin
          begin
            inclocked(Thread_count);
            inclocked(Thread_count);
 
 
-           WinEnterCriticalSection(AttachingThread);
            if Win32GetCurrentThreadId <> MainThreadIdWin32 then
            if Win32GetCurrentThreadId <> MainThreadIdWin32 then
            begin
            begin
              { Allocate Threadvars  }
              { Allocate Threadvars  }
@@ -67,7 +65,6 @@ function Dll_entry{$ifdef FPC_HAS_INDIRECT_MAIN_INFORMATION}(const info : TEntry
            if assigned(Dll_Thread_Attach_Hook) then
            if assigned(Dll_Thread_Attach_Hook) then
              Dll_Thread_Attach_Hook(DllParam);
              Dll_Thread_Attach_Hook(DllParam);
            Dll_entry:=true; { return value is ignored }
            Dll_entry:=true; { return value is ignored }
-           WinLeaveCriticalSection(AttachingThread);
         end;
         end;
        DLL_THREAD_DETACH :
        DLL_THREAD_DETACH :
          begin
          begin
@@ -92,7 +89,6 @@ function Dll_entry{$ifdef FPC_HAS_INDIRECT_MAIN_INFORMATION}(const info : TEntry
            DoneThread;
            DoneThread;
            { Free TLS resources used by ThreadVars }
            { Free TLS resources used by ThreadVars }
            SysFiniMultiThreading;
            SysFiniMultiThreading;
-           WinDoneCriticalSection(AttachingThread);
 		   MainThreadIDWin32:=0;
 		   MainThreadIDWin32:=0;
          end;
          end;
      end;
      end;