mirror of
https://github.com/reactos/reactos.git
synced 2025-02-25 01:39:30 +00:00
- When SendMessageTimeout times out, the CompletionEvent goes out of scope,
so tell the target thread not to signal it - Replace message queue hardware lock FAST_MUTEX with KMUTEX so it can be recursively acquired svn path=/trunk/; revision=9018
This commit is contained in:
parent
c3cb9779e3
commit
9edefdbda2
2 changed files with 21 additions and 6 deletions
|
@ -50,7 +50,7 @@ typedef struct _USER_MESSAGE_QUEUE
|
||||||
/* Queue for hardware messages for the queue. */
|
/* Queue for hardware messages for the queue. */
|
||||||
LIST_ENTRY HardwareMessagesListHead;
|
LIST_ENTRY HardwareMessagesListHead;
|
||||||
/* Lock for the hardware message list. */
|
/* Lock for the hardware message list. */
|
||||||
FAST_MUTEX HardwareLock;
|
KMUTEX HardwareLock;
|
||||||
/* Lock for the queue. */
|
/* Lock for the queue. */
|
||||||
FAST_MUTEX Lock;
|
FAST_MUTEX Lock;
|
||||||
/* Pointer to the current WM_MOUSEMOVE message */
|
/* Pointer to the current WM_MOUSEMOVE message */
|
||||||
|
@ -189,10 +189,10 @@ LPARAM FASTCALL MsqGetMessageExtraInfo(VOID);
|
||||||
ExReleaseFastMutex(&MsgQueue->Lock)
|
ExReleaseFastMutex(&MsgQueue->Lock)
|
||||||
|
|
||||||
#define IntLockHardwareMessageQueue(MsgQueue) \
|
#define IntLockHardwareMessageQueue(MsgQueue) \
|
||||||
ExAcquireFastMutex(&MsgQueue->HardwareLock)
|
KeWaitForMutexObject(&MsgQueue->HardwareLock, UserRequest, KernelMode, FALSE, NULL)
|
||||||
|
|
||||||
#define IntUnLockHardwareMessageQueue(MsgQueue) \
|
#define IntUnLockHardwareMessageQueue(MsgQueue) \
|
||||||
ExReleaseFastMutex(&MsgQueue->HardwareLock)
|
KeReleaseMutex(&MsgQueue->HardwareLock, FALSE)
|
||||||
|
|
||||||
/* check the queue status */
|
/* check the queue status */
|
||||||
#define MsqIsSignaled(MsgQueue) \
|
#define MsqIsSignaled(MsgQueue) \
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: msgqueue.c,v 1.80 2004/03/31 19:44:34 weiden Exp $
|
/* $Id: msgqueue.c,v 1.81 2004/04/07 21:12:08 gvg Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -906,6 +906,7 @@ MsqSendMessage(PUSER_MESSAGE_QUEUE MessageQueue,
|
||||||
LRESULT Result;
|
LRESULT Result;
|
||||||
PUSER_MESSAGE_QUEUE ThreadQueue;
|
PUSER_MESSAGE_QUEUE ThreadQueue;
|
||||||
LARGE_INTEGER Timeout;
|
LARGE_INTEGER Timeout;
|
||||||
|
PLIST_ENTRY Entry;
|
||||||
|
|
||||||
KeInitializeEvent(&CompletionEvent, NotificationEvent, FALSE);
|
KeInitializeEvent(&CompletionEvent, NotificationEvent, FALSE);
|
||||||
|
|
||||||
|
@ -944,7 +945,21 @@ MsqSendMessage(PUSER_MESSAGE_QUEUE MessageQueue,
|
||||||
WaitStatus = KeWaitForMultipleObjects(2, WaitObjects, WaitAny, UserRequest,
|
WaitStatus = KeWaitForMultipleObjects(2, WaitObjects, WaitAny, UserRequest,
|
||||||
UserMode, FALSE, (uTimeout ? &Timeout : NULL), NULL);
|
UserMode, FALSE, (uTimeout ? &Timeout : NULL), NULL);
|
||||||
if(WaitStatus == STATUS_TIMEOUT)
|
if(WaitStatus == STATUS_TIMEOUT)
|
||||||
{DbgPrint("MsqSendMessage timed out\n");
|
{
|
||||||
|
IntLockMessageQueue(MessageQueue);
|
||||||
|
Entry = MessageQueue->SentMessagesListHead.Flink;
|
||||||
|
while (Entry != &MessageQueue->SentMessagesListHead)
|
||||||
|
{
|
||||||
|
if ((PUSER_SENT_MESSAGE) CONTAINING_RECORD(Entry, USER_SENT_MESSAGE, ListEntry)
|
||||||
|
== Message)
|
||||||
|
{
|
||||||
|
Message->CompletionEvent = NULL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Entry = Entry->Flink;
|
||||||
|
}
|
||||||
|
IntUnLockMessageQueue(MessageQueue);
|
||||||
|
DbgPrint("MsqSendMessage timed out\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
while (MsqDispatchOneSentMessage(ThreadQueue))
|
while (MsqDispatchOneSentMessage(ThreadQueue))
|
||||||
|
@ -1066,7 +1081,7 @@ MsqInitializeMessageQueue(struct _ETHREAD *Thread, PUSER_MESSAGE_QUEUE MessageQu
|
||||||
InitializeListHead(&MessageQueue->PostedMessagesListHead);
|
InitializeListHead(&MessageQueue->PostedMessagesListHead);
|
||||||
InitializeListHead(&MessageQueue->SentMessagesListHead);
|
InitializeListHead(&MessageQueue->SentMessagesListHead);
|
||||||
InitializeListHead(&MessageQueue->HardwareMessagesListHead);
|
InitializeListHead(&MessageQueue->HardwareMessagesListHead);
|
||||||
ExInitializeFastMutex(&MessageQueue->HardwareLock);
|
KeInitializeMutex(&MessageQueue->HardwareLock, 0);
|
||||||
ExInitializeFastMutex(&MessageQueue->Lock);
|
ExInitializeFastMutex(&MessageQueue->Lock);
|
||||||
MessageQueue->QuitPosted = FALSE;
|
MessageQueue->QuitPosted = FALSE;
|
||||||
MessageQueue->QuitExitCode = 0;
|
MessageQueue->QuitExitCode = 0;
|
||||||
|
|
Loading…
Reference in a new issue