From 8c38f45a7e27c9d9f96610de3fa600b427738829 Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Mon, 3 May 1999 09:44:57 +0000 Subject: [PATCH] Fixed some deadlock(s) in message sending. --- windows/queue.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/windows/queue.c b/windows/queue.c index 3418ef3b5cc..382c0108f48 100644 --- a/windows/queue.c +++ b/windows/queue.c @@ -701,8 +701,19 @@ int QUEUE_WaitBits( WORD bits, DWORD timeout ) if ( !THREAD_IsWin16( THREAD_Current() ) ) { - /* win32 thread, use WaitForMultipleObjects */ - MsgWaitForMultipleObjects( 0, NULL, FALSE, timeout, queue->wakeMask ); + BOOL bHasWin16Lock; + DWORD dwlc; + + if ( (bHasWin16Lock = _ConfirmWin16Lock()) ) + { + TRACE_(msg)("bHasWin16Lock=TRUE\n"); + ReleaseThunkLock( &dwlc ); + } + WaitForSingleObject( queue->hEvent, timeout ); + if ( bHasWin16Lock ) + { + RestoreThunkLock( dwlc ); + } } else { @@ -714,14 +725,14 @@ int QUEUE_WaitBits( WORD bits, DWORD timeout ) if (GetTickCount() - curTime > timeout) { - QUEUE_Unlock( queue ); + QUEUE_Unlock( queue ); return 0; /* exit with timeout */ } Yield16(); } + } } } -} /*********************************************************************** -- 2.11.4.GIT