Commit 869b0442 authored by Jukka Heinonen's avatar Jukka Heinonen Committed by Alexandre Julliard

Routine DOSVM_Wait now wakes up if new events are queued and it

returns if it processed any queued events.
parent 96328b37
...@@ -85,6 +85,7 @@ typedef struct _DOSEVENT { ...@@ -85,6 +85,7 @@ typedef struct _DOSEVENT {
static CRITICAL_SECTION qcrit = CRITICAL_SECTION_INIT("DOSVM"); static CRITICAL_SECTION qcrit = CRITICAL_SECTION_INIT("DOSVM");
static struct _DOSEVENT *pending_event, *current_event; static struct _DOSEVENT *pending_event, *current_event;
static int sig_sent; static int sig_sent;
static HANDLE event_notifier;
static CONTEXT86 *current_context; static CONTEXT86 *current_context;
static int DOSVM_SimulateInt( int vect, CONTEXT86 *context, BOOL inwine ) static int DOSVM_SimulateInt( int vect, CONTEXT86 *context, BOOL inwine )
...@@ -210,6 +211,10 @@ void WINAPI DOSVM_QueueEvent( INT irq, INT priority, DOSRELAY relay, LPVOID data ...@@ -210,6 +211,10 @@ void WINAPI DOSVM_QueueEvent( INT irq, INT priority, DOSRELAY relay, LPVOID data
} else { } else {
TRACE("new event queued (time=%ld)\n", GetTickCount()); TRACE("new event queued (time=%ld)\n", GetTickCount());
} }
/* Wake up DOSVM_Wait so that it can serve pending events. */
SetEvent(event_notifier);
LeaveCriticalSection(&qcrit); LeaveCriticalSection(&qcrit);
} else { } else {
/* DOS subsystem not running */ /* DOS subsystem not running */
...@@ -299,13 +304,14 @@ void WINAPI DOSVM_Wait( INT read_pipe, HANDLE hObject ) ...@@ -299,13 +304,14 @@ void WINAPI DOSVM_Wait( INT read_pipe, HANDLE hObject )
{ {
MSG msg; MSG msg;
DWORD waitret; DWORD waitret;
HANDLE objs[2]; HANDLE objs[3];
int objc; int objc;
BOOL got_msg = FALSE; BOOL got_msg = FALSE;
objs[0]=GetStdHandle(STD_INPUT_HANDLE); objs[0]=GetStdHandle(STD_INPUT_HANDLE);
objs[1]=hObject; objs[1]=event_notifier;
objc=hObject?2:1; objs[2]=hObject;
objc=hObject?3:2;
do { do {
/* check for messages (waste time before the response check below) */ /* check for messages (waste time before the response check below) */
if (PeekMessageA) if (PeekMessageA)
...@@ -335,6 +341,7 @@ chk_console_input: ...@@ -335,6 +341,7 @@ chk_console_input:
IF_SET(&context); IF_SET(&context);
SET_PEND(&context); SET_PEND(&context);
DOSVM_SendQueuedEvents(&context); DOSVM_SendQueuedEvents(&context);
got_msg = TRUE;
} }
if (got_msg) break; if (got_msg) break;
} else { } else {
...@@ -356,7 +363,7 @@ chk_console_input: ...@@ -356,7 +363,7 @@ chk_console_input:
ERR_(module)("dosvm wait error=%ld\n",GetLastError()); ERR_(module)("dosvm wait error=%ld\n",GetLastError());
} }
if ((read_pipe != -1) && hObject) { if ((read_pipe != -1) && hObject) {
if (waitret==(WAIT_OBJECT_0+1)) break; if (waitret==(WAIT_OBJECT_0+2)) break;
} }
if (waitret==WAIT_OBJECT_0) if (waitret==WAIT_OBJECT_0)
goto chk_console_input; goto chk_console_input;
...@@ -677,6 +684,10 @@ BOOL WINAPI DOSVM_Init( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved ...@@ -677,6 +684,10 @@ BOOL WINAPI DOSVM_Init( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved
TRACE("Initializing DOS memory structures\n"); TRACE("Initializing DOS memory structures\n");
DOSMEM_Init( TRUE ); DOSMEM_Init( TRUE );
DOSDEV_InstallDOSDevices(); DOSDEV_InstallDOSDevices();
event_notifier = CreateEventA(NULL, FALSE, FALSE, NULL);
if(!event_notifier)
ERR("Failed to create event object!\n");
} }
return TRUE; return TRUE;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment