Author: dick
Date: 2006-03-27 04:28:30 -0500 (Mon, 27 Mar 2006)
New Revision: 58563

Modified:
   branches/mono-1-1-13/mono/mono/io-layer/ChangeLog
   branches/mono-1-1-13/mono/mono/io-layer/shared.c
Log:

2006-03-27  Dick Porter  <[EMAIL PROTECTED]>

        * shared.c (_wapi_shm_file_open): Break out of a loop if the
        shared file is smaller than expected.  (We loop a few times in
        case another process is in the middle of creating the file.)




Modified: branches/mono-1-1-13/mono/mono/io-layer/ChangeLog
===================================================================
--- branches/mono-1-1-13/mono/mono/io-layer/ChangeLog   2006-03-27 09:21:38 UTC 
(rev 58562)
+++ branches/mono-1-1-13/mono/mono/io-layer/ChangeLog   2006-03-27 09:28:30 UTC 
(rev 58563)
@@ -1,3 +1,9 @@
+2006-03-27  Dick Porter  <[EMAIL PROTECTED]>
+
+       * shared.c (_wapi_shm_file_open): Break out of a loop if the
+       shared file is smaller than expected.  (We loop a few times in
+       case another process is in the middle of creating the file.)
+
 2006-03-22  Dick Porter  <[EMAIL PROTECTED]>
 
        * handles.c:

Modified: branches/mono-1-1-13/mono/mono/io-layer/shared.c
===================================================================
--- branches/mono-1-1-13/mono/mono/io-layer/shared.c    2006-03-27 09:21:38 UTC 
(rev 58562)
+++ branches/mono-1-1-13/mono/mono/io-layer/shared.c    2006-03-27 09:28:30 UTC 
(rev 58563)
@@ -104,10 +104,18 @@
 {
        int fd;
        struct stat statbuf;
-       int ret;
+       int ret, tries = 0;
        gboolean created = FALSE;
        
 try_again:
+       if (tries++ > 10) {
+               /* Just give up */
+               return (-1);
+       } else if (tries > 5) {
+               /* Break out of a loop */
+               unlink (filename);
+       }
+       
        /* No O_CREAT yet, because we need to initialise the file if
         * we have to create it.
         */
@@ -195,6 +203,7 @@
                        return(-1);
                } else {
                        /* We didn't create it, so just try opening it again */
+                       _wapi_handle_spin (100);
                        goto try_again;
                }
        }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to