Vincent Povirk : ole32: Add a 20 second timeout when attempting to grab locks.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Mar 11 10:00:42 CDT 2015


Module: wine
Branch: master
Commit: eead04803f045ba85d3a49c228e04c29ad484ff8
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=eead04803f045ba85d3a49c228e04c29ad484ff8

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Tue Mar 10 14:47:33 2015 -0500

ole32: Add a 20 second timeout when attempting to grab locks.

---

 dlls/ole32/storage32.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c
index d3fb023..64b3e13 100644
--- a/dlls/ole32/storage32.c
+++ b/dlls/ole32/storage32.c
@@ -2875,6 +2875,7 @@ static HRESULT StorageImpl_LockRegionSync(StorageImpl *This, ULARGE_INTEGER offs
 {
     HRESULT hr;
     int delay = 0;
+    DWORD start_time = GetTickCount();
 
     do
     {
@@ -2882,6 +2883,11 @@ static HRESULT StorageImpl_LockRegionSync(StorageImpl *This, ULARGE_INTEGER offs
 
         if (hr == STG_E_ACCESSDENIED || hr == STG_E_LOCKVIOLATION)
         {
+            if (GetTickCount() - start_time >= 20000)
+            {
+                /* timeout */
+                break;
+            }
             Sleep(delay);
             if (delay < 150) delay++;
         }




More information about the wine-cvs mailing list