* dcrt0.cc (user32_init): Add primitive guard against concurrent attempts to

call this function.  Also add temporary debugging code to display a message if
the function is called multiple times.
(api32_init): Ditto.
This commit is contained in:
Christopher Faylor 2000-07-03 01:55:17 +00:00
parent c8c609ff0a
commit b6cdb2c349
2 changed files with 32 additions and 3 deletions

View File

@ -1,3 +1,10 @@
Sun Jul 2 21:50:48 2000 Christopher Faylor <cgf@cygnus.com>
* dcrt0.cc (user32_init): Add primitive guard against concurrent
attempts to call this function. Also add temporary debugging code to
display a message if the function is called multiple times.
(api32_init): Ditto.
Sun Jul 2 10:39:00 2000 Corinna Vinschen <corinna@vinschen.de>
* winsup.h: Define MAX_SID_LEN and new MAX_HOST_NAME.

View File

@ -1108,25 +1108,47 @@ gotit:
LoadDLLinitfunc (user32)
{
HANDLE h;
static NO_COPY LONG here = -1L;
if ((h = LoadLibrary ("user32.dll")) != NULL)
while (InterlockedIncrement (&here))
{
InterlockedDecrement (&here);
small_printf ("Multiple tries to read user32.dll\n");
Sleep (0);
}
if (user32_handle)
/* nothing to do */;
else if ((h = LoadLibrary ("user32.dll")) != NULL)
user32_handle = h;
else if (!user32_handle)
api_fatal ("could not load user32.dll, %E");
InterlockedDecrement (&here);
return 0; /* Already done by another thread? */
}
LoadDLLinitfunc (advapi32)
{
HANDLE h;
static NO_COPY LONG here = -1L;
if ((h = LoadLibrary ("advapi32.dll")) != NULL)
while (InterlockedIncrement (&here))
{
InterlockedDecrement (&here);
small_printf ("Multiple tries to read advapi32.dll\n");
Sleep (0);
}
if (advapi32_handle)
/* nothing to do */;
else if ((h = LoadLibrary ("advapi32.dll")) != NULL)
advapi32_handle = h;
else if (!advapi32_handle)
api_fatal ("could not load advapi32.dll, %E");
return 0; /* Already done by another thread? */
InterlockedDecrement (&here);
return 0;
}
static void dummy_autoload (void) __attribute__ ((unused));