[4/5] ole32: Add a 20 second timeout when attempting to grab locks.

Vincent Povirk madewokherd at gmail.com
Tue Mar 10 16:35:10 CDT 2015


-------------- next part --------------
From ff4a106f2a9d85ad732ddf83cd8681d670f87725 Mon Sep 17 00:00:00 2001
From: Vincent Povirk <vincent at codeweavers.com>
Date: Tue, 10 Mar 2015 14:47:33 -0500
Subject: [PATCH 4/5] 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++;
         }
-- 
2.1.0



More information about the wine-patches mailing list