Fix some thread-safeness problem when accessing the system message
queue.
This commit is contained in:
parent
592c910b7c
commit
1242311e67
|
@ -466,11 +466,15 @@ static BOOL32 MSG_PeekHardwareMsg( MSG32 *msg, HWND32 hwnd, DWORD first, DWORD l
|
||||||
DWORD status = SYSQ_MSG_ACCEPT;
|
DWORD status = SYSQ_MSG_ACCEPT;
|
||||||
MESSAGEQUEUE *sysMsgQueue = QUEUE_GetSysQueue();
|
MESSAGEQUEUE *sysMsgQueue = QUEUE_GetSysQueue();
|
||||||
int kbd_msg;
|
int kbd_msg;
|
||||||
QMSG *nextqmsg, *qmsg = sysMsgQueue->firstMsg;
|
QMSG *nextqmsg, *qmsg = 0;
|
||||||
|
|
||||||
/* FIXME: there has to be a better way to do this */
|
/* FIXME: there has to be a better way to do this */
|
||||||
joySendMessages();
|
joySendMessages();
|
||||||
|
|
||||||
|
EnterCriticalSection(&sysMsgQueue->cSection);
|
||||||
|
|
||||||
|
qmsg = sysMsgQueue->firstMsg;
|
||||||
|
|
||||||
/* If the queue is empty, attempt to fill it */
|
/* If the queue is empty, attempt to fill it */
|
||||||
if (!sysMsgQueue->msgCount && THREAD_IsWin16( THREAD_Current() )
|
if (!sysMsgQueue->msgCount && THREAD_IsWin16( THREAD_Current() )
|
||||||
&& EVENT_Pending())
|
&& EVENT_Pending())
|
||||||
|
@ -557,6 +561,7 @@ static BOOL32 MSG_PeekHardwareMsg( MSG32 *msg, HWND32 hwnd, DWORD first, DWORD l
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
case SYSQ_MSG_ABANDON:
|
case SYSQ_MSG_ABANDON:
|
||||||
|
LeaveCriticalSection(&sysMsgQueue->cSection);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -565,8 +570,10 @@ static BOOL32 MSG_PeekHardwareMsg( MSG32 *msg, HWND32 hwnd, DWORD first, DWORD l
|
||||||
if (HOOK_IsHooked( WH_JOURNALRECORD )) MSG_JournalRecordMsg( msg );
|
if (HOOK_IsHooked( WH_JOURNALRECORD )) MSG_JournalRecordMsg( msg );
|
||||||
QUEUE_RemoveMsg( sysMsgQueue, qmsg );
|
QUEUE_RemoveMsg( sysMsgQueue, qmsg );
|
||||||
}
|
}
|
||||||
|
LeaveCriticalSection(&sysMsgQueue->cSection);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
LeaveCriticalSection(&sysMsgQueue->cSection);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue