mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 12:49:33 +02:00
* Windows TLS callbacks, call SysInitMultithreading early, it is necessary because if a statically loaded DLL creates a thread, apparently DLL_THREAD_ATTACH callback executes right away before the entry point. In turn, DLL_THREAD_ATTACH requires TLSIndex to be initialized.
git-svn-id: trunk@19693 -
This commit is contained in:
parent
c8e65c501a
commit
266acd1bed
@ -340,7 +340,13 @@ procedure Exec_Tls_callback(Handle : pointer; reason : Dword; Reserved : pointer
|
||||
case reason of
|
||||
{ For executables, DLL_PROCESS_ATTACH is called *before* the entry point,
|
||||
and DLL_PROCESS_DETACH is called *after* RTL shuts down and calls ExitProcess.
|
||||
It isn't a good idea to handle resources of the main thread at these points. }
|
||||
It isn't a good idea to handle resources of the main thread at these points.
|
||||
SysInitMultithreading is necessary however, because if some statically loaded
|
||||
DLL creates a thread, it will invoke DLL_THREAD_ATTACH before anything else is
|
||||
initialized. }
|
||||
DLL_PROCESS_ATTACH:
|
||||
SysInitMultithreading;
|
||||
|
||||
DLL_THREAD_ATTACH :
|
||||
begin
|
||||
{ !!! SysInitMultithreading must NOT be called here. Windows guarantees that
|
||||
|
Loading…
Reference in New Issue
Block a user