Am 11.10.2010 00:16, schrieb Bernd Kreuss:
from rtl/win/syswin.inc:

        DLL_THREAD_ATTACH :
          begin
            inclocked(Thread_count);

            WinEnterCriticalSection(AttachingThread);
            if Win32GetCurrentThreadId<>  MainThreadIdWin32 then
            begin
              { Allocate Threadvars  }
              SysAllocateThreadVars;

              { NS : no idea what is correct to pass here - pass dummy value 
for now }
              { passing a dummy is ok, the correct value is read from the coff 
header of SysInstance (FK) }
              InitThread($1000000); { Assume everything is idempotent there, as 
the thread could have been created with BeginThread... }
            end;

            if assigned(Dll_Thread_Attach_Hook) then
              Dll_Thread_Attach_Hook(DllParam);
            Dll_entry:=true; { return value is ignored }
            WinLeaveCriticalSection(AttachingThread);
         end;

will this also work when some object in my own dll is starting a thread
with TThread that is already properly initialized or will it then try to
initialize it twice?

Although you've said that you've found the problem: yes, that is a concern that occured to me as well after I reported the problem of the AttachingThread critical section. I'll need to look into it what problems there really could arise and how it might be fixed.

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to