* shared.cc (user_shared_initialize): Implement locking similar to shared_info

when initializing shared region.
This commit is contained in:
Christopher Faylor 2005-04-23 03:24:21 +00:00
parent 098a429002
commit bc79d16453
2 changed files with 10 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2005-04-22 Christopher Faylor <cgf@timesys.com>
* shared.cc (user_shared_initialize): Implement locking similar to
shared_info when initializing shared region.
2005-04-22 Christopher Faylor <cgf@timesys.com>
* fhandler.h (dev_console::set_color): Define new function.

View File

@ -172,8 +172,9 @@ user_shared_initialize (bool reinit)
ProtectHandleINH (cygwin_user_h);
debug_printf ("user shared version %x", user_shared->version);
DWORD sversion = (DWORD) InterlockedExchange ((LONG *) &user_shared->version, USER_VERSION_MAGIC);
/* Initialize the Cygwin per-user shared, if necessary */
if (!user_shared->version)
if (!sversion)
{
user_shared->version = USER_VERSION_MAGIC;
debug_printf ("initializing user shared");
@ -189,6 +190,9 @@ user_shared_initialize (bool reinit)
multiple_cygwin_problem ("user shared memory version", user_shared->version, USER_VERSION_MAGIC);
else if (user_shared->cb != sizeof (*user_shared))
multiple_cygwin_problem ("user shared memory size", user_shared->cb, sizeof (*user_shared));
else
while (!user_shared->cb)
low_priority_sleep (0); // Should be hit only very very rarely
}
void