wined3d-CSMT_Main: Added patch to avoid calling SetEvent when worker thread is fast enough.

This commit is contained in:
Sebastian Lackner
2016-08-19 00:47:59 +02:00
parent a8ed1e17c2
commit fbe5fa909a
3 changed files with 28 additions and 1 deletions

View File

@@ -0,0 +1,26 @@
From 3ad4bff5048dec66d702823df7f9e6ea0f9041d8 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Thu, 18 Aug 2016 20:50:52 +0200
Subject: wined3d: Do not signal CS event when we manage to unset
waiting_for_event quickly enough.
---
dlls/wined3d/cs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 02ca2de..ae540c8 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -3000,7 +3000,7 @@ static void wined3d_cs_wait_event(struct wined3d_cs *cs)
* of doing so. Wait for the event to reset it. ResetEvent is not good
* because the main thread might be beween the waiting_for_event reset
* and SignalEvent call. */
- if (!InterlockedCompareExchange(&cs->waiting_for_event, FALSE, FALSE))
+ if (!InterlockedCompareExchange(&cs->waiting_for_event, FALSE, TRUE))
WaitForSingleObject(cs->event, INFINITE);
}
else
--
2.9.0

View File

@@ -3380,7 +3380,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
+ * of doing so. Wait for the event to reset it. ResetEvent is not good
+ * because the main thread might be beween the waiting_for_event reset
+ * and SignalEvent call. */
+ if (!InterlockedCompareExchange(&cs->waiting_for_event, FALSE, FALSE))
+ if (!InterlockedCompareExchange(&cs->waiting_for_event, FALSE, TRUE))
+ WaitForSingleObject(cs->event, INFINITE);
+ }
+ else