From: Corinna Vinschen Date: Fri, 11 Aug 2006 15:40:07 +0000 (+0000) Subject: * shared.cc (open_shared): Desperately try to get shared memory, only X-Git-Tag: newlib-csl-sourcerygxx-3_4_4-25~25 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=e39a29e36b46bcc6bdbb7952872a33375b13d35a;p=newlib-cygwin.git * shared.cc (open_shared): Desperately try to get shared memory, only when DEBUGGING enabled for now. --- diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 8aed544f1..857f1e714 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2006-08-11 Corinna Vinschen + + * shared.cc (open_shared): Desperately try to get shared memory, only + when DEBUGGING enabled for now. + 2006-08-10 Christopher Faylor * pinfo.cc (_onreturn::~onreturn): Don't attempt to close a NULL diff --git a/winsup/cygwin/shared.cc b/winsup/cygwin/shared.cc index 65965b58b..2524ecabc 100644 --- a/winsup/cygwin/shared.cc +++ b/winsup/cygwin/shared.cc @@ -93,6 +93,30 @@ open_shared (const char *name, int n, HANDLE& shared_h, DWORD size, { shared_h = CreateFileMapping (INVALID_HANDLE_VALUE, psa, PAGE_READWRITE, 0, size, mapname); +#ifdef DEBUGGING + if (!shared_h && GetLastError () == NO_ERROR) + { + system_printf ("CreateFileMapping %s, %E. Retry Open", mapname); + shared_h = OpenFileMapping (access, FALSE, mapname); + if (!shared_h) + { + system_printf ("OpenFileMapping %s, %E. Retry Create " + "after sleep (check timing problem)", mapname); + Sleep (1000L); + shared_h = CreateFileMapping (INVALID_HANDLE_VALUE, psa, + PAGE_READWRITE, 0, size, + mapname); + if (!shared_h) + system_printf ("Retried CreateFileMapping %s, %E.", + mapname); + else + system_printf ("Retried CreateFileMapping %s succeeded!", + mapname); + } + else + system_printf ("OpenFileMapping %s succeeded!", mapname); + } +#endif if (GetLastError () == ERROR_ALREADY_EXISTS) m = SH_JUSTOPEN; }