This is the mail archive of the cygwin-patches@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] fix startup race in shared.cc


Still seeing incorrect "version mismatch" messages for processes
starting simultaneously on dual-processor systems; I believe this
patch to the recent locking work in shared.cc fixes the "user shared
memory version" errors I'm seeing.

Thanks,
-Usman



2005-05-03  Usman Muzaffar <foo@muzaffar.org>

* shared.cc (user_shared_initialize): Check for mismatched user
  shared memory version with result from InterlockedExchange to
  avoid startup race.


Index: cygwin/shared.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/shared.cc,v
retrieving revision 1.94
diff -u -p -r1.94 shared.cc
--- cygwin/shared.cc 30 Apr 2005 17:07:05 -0000 1.94
+++ cygwin/shared.cc 3 May 2005 23:20:02 -0000
@@ -199,8 +199,8 @@ user_shared_initialize (bool reinit)
       /* Initialize the queue of deleted files.  */
       user_shared->delqueue.init ();
     }
-  else if (user_shared->version != USER_VERSION_MAGIC)
-    multiple_cygwin_problem ("user shared memory version", user_shared->version, USER_VERSION_MAGIC);
+  else if (sversion != USER_VERSION_MAGIC)
+    multiple_cygwin_problem ("user shared memory version", sversion, 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




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]