Author: dick
Date: 2005-03-21 09:22:52 -0500 (Mon, 21 Mar 2005)
New Revision: 42048

Modified:
   branches/dick/io-layer-no-daemon/handles.c
Log:
More locking for file shares

Modified: branches/dick/io-layer-no-daemon/handles.c
===================================================================
--- branches/dick/io-layer-no-daemon/handles.c  2005-03-21 12:38:38 UTC (rev 
42047)
+++ branches/dick/io-layer-no-daemon/handles.c  2005-03-21 14:22:52 UTC (rev 
42048)
@@ -1727,10 +1727,23 @@
 
 void _wapi_handle_update_refs (void)
 {
-       guint32 i;
+       guint32 i, lock_now;
+       int thr_ret;
        
        _WAPI_HANDLE_COLLECTION_UNSAFE;
 
+       /* Prevent file share entries racing with us */
+       do {
+               lock_now = (guint32)(time(NULL) & 0xFFFFFFFF);
+
+               thr_ret = _wapi_timestamp_exclusion 
(&_wapi_fileshare_layout->share_check, lock_now);
+
+               if (thr_ret == EBUSY) {
+                       _wapi_handle_spin (100);
+               }
+       } while (thr_ret == EBUSY);
+       g_assert(thr_ret == 0);
+
        for (i = 0; i < _wapi_private_handle_count; i++) {
                struct _WapiHandleUnshared *handle = &_wapi_private_handles[i];
                guint32 now = (guint32)(time (NULL) & 0xFFFFFFFF);
@@ -1772,5 +1785,6 @@
                }
        }
        
+       thr_ret = _wapi_timestamp_release 
(&_wapi_fileshare_layout->share_check, lock_now);
        _WAPI_HANDLE_COLLECTION_SAFE;
 }

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

Reply via email to