Jacek Caban : winex11: Use pthread for error handler locking.

Alexandre Julliard julliard at winehq.org
Mon Apr 18 16:08:47 CDT 2022


Module: wine
Branch: master
Commit: 9a320b39387d33e5a180b5db65cea05ce8ba4fe9
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=9a320b39387d33e5a180b5db65cea05ce8ba4fe9

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Apr 18 14:41:18 2022 +0200

winex11: Use pthread for error handler locking.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winex11.drv/x11drv_main.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c
index c286d2fd1f2..203237f24aa 100644
--- a/dlls/winex11.drv/x11drv_main.c
+++ b/dlls/winex11.drv/x11drv_main.c
@@ -96,15 +96,7 @@ static BOOL use_xim = TRUE;
 static WCHAR input_style[20];
 
 static pthread_mutex_t d3dkmt_mutex = PTHREAD_MUTEX_INITIALIZER;
-
-static CRITICAL_SECTION x11drv_error_section;
-static CRITICAL_SECTION_DEBUG x11drv_error_section_debug =
-{
-    0, 0, &x11drv_error_section,
-    { &x11drv_error_section_debug.ProcessLocksList, &x11drv_error_section_debug.ProcessLocksList },
-    0, 0, { (DWORD_PTR)(__FILE__ ": x11drv_error_section") }
-};
-static CRITICAL_SECTION x11drv_error_section = { &x11drv_error_section_debug, -1, 0, 0, 0, 0 };
+static pthread_mutex_t error_mutex = PTHREAD_MUTEX_INITIALIZER;
 
 struct d3dkmt_vidpn_source
 {
@@ -255,7 +247,7 @@ static inline BOOL ignore_error( Display *display, XErrorEvent *event )
  */
 void X11DRV_expect_error( Display *display, x11drv_error_callback callback, void *arg )
 {
-    EnterCriticalSection( &x11drv_error_section );
+    pthread_mutex_lock( &error_mutex );
     err_callback         = callback;
     err_callback_display = display;
     err_callback_arg     = arg;
@@ -274,7 +266,7 @@ int X11DRV_check_error(void)
 {
     int res = err_callback_result;
     err_callback = NULL;
-    LeaveCriticalSection( &x11drv_error_section );
+    pthread_mutex_unlock( &error_mutex );
     return res;
 }
 




More information about the wine-cvs mailing list