Fix input/output (read/write) waiter threads notifications. Now console is usable.
Go and test it! :D

svn path=/branches/ros-csrss/; revision=58225
This commit is contained in:
Hermès Bélusca-Maïto 2013-01-26 16:12:05 +00:00
parent 50a9e6a485
commit 6d28ec8640
3 changed files with 42 additions and 27 deletions

View file

@ -93,6 +93,10 @@ ConioProcessChar(PCONSOLE Console,
WaitAny,
NULL,
NULL);
if (!IsListEmpty(&Console->InputBuffer.ReadWaitQueue))
{
CsrDereferenceWait(&Console->InputBuffer.ReadWaitQueue);
}
return STATUS_SUCCESS;
}
@ -358,18 +362,6 @@ ReadInputBufferThread(IN PLIST_ENTRY WaitList,
DPRINT1("ReadInputBufferThread - WaitContext = 0x%p, WaitArgument1 = 0x%p, WaitArgument2 = 0x%p, WaitFlags = %lu\n", WaitContext, WaitArgument1, WaitArgument2, WaitFlags);
/*
* Somebody is closing a handle to this input buffer,
* by calling ConSrvCloseHandleEntry.
* See whether we are linked to that handle (ie. we
* are a waiter for this handle), and if so, return.
*/
if (InputHandle == InputInfo->HandleEntry)
{
Status = STATUS_ALERTED;
goto Quit;
}
/*
* If we are notified of the process termination via a call
* to CsrNotifyWaitBlock triggered by CsrDestroyProcess or
@ -381,6 +373,20 @@ ReadInputBufferThread(IN PLIST_ENTRY WaitList,
goto Quit;
}
/*
* Somebody is closing a handle to this input buffer,
* by calling ConSrvCloseHandleEntry.
* See whether we are linked to that handle (ie. we
* are a waiter for this handle), and if so, return.
* Otherwise, ignore the call and continue waiting.
*/
if (InputHandle != NULL)
{
Status = (InputHandle == InputInfo->HandleEntry ? STATUS_ALERTED
: STATUS_PENDING);
goto Quit;
}
/*
* If we go there, that means we are notified for some new input.
* The console is therefore already locked.
@ -489,18 +495,6 @@ ReadCharsThread(IN PLIST_ENTRY WaitList,
DPRINT1("ReadCharsThread - WaitContext = 0x%p, WaitArgument1 = 0x%p, WaitArgument2 = 0x%p, WaitFlags = %lu\n", WaitContext, WaitArgument1, WaitArgument2, WaitFlags);
/*
* Somebody is closing a handle to this input buffer,
* by calling ConSrvCloseHandleEntry.
* See whether we are linked to that handle (ie. we
* are a waiter for this handle), and if so, return.
*/
if (InputHandle == InputInfo->HandleEntry)
{
Status = STATUS_ALERTED;
goto Quit;
}
/*
* If we are notified of the process termination via a call
* to CsrNotifyWaitBlock triggered by CsrDestroyProcess or
@ -512,6 +506,20 @@ ReadCharsThread(IN PLIST_ENTRY WaitList,
goto Quit;
}
/*
* Somebody is closing a handle to this input buffer,
* by calling ConSrvCloseHandleEntry.
* See whether we are linked to that handle (ie. we
* are a waiter for this handle), and if so, return.
* Otherwise, ignore the call and continue waiting.
*/
if (InputHandle != NULL)
{
Status = (InputHandle == InputInfo->HandleEntry ? STATUS_ALERTED
: STATUS_PENDING);
goto Quit;
}
/*
* If we go there, that means we are notified for some new input.
* The console is therefore already locked.

View file

@ -15,6 +15,7 @@
//#define NDEBUG
#include <debug.h>
/* FUNCTIONS *****************************************************************/
BOOL FASTCALL
@ -87,6 +88,10 @@ ConioUnpause(PCONSOLE Console, UINT Flags)
WaitAll,
NULL,
NULL);
if (!IsListEmpty(&Console->WriteWaitQueue))
{
CsrDereferenceWait(&Console->WriteWaitQueue);
}
}
}

View file

@ -73,7 +73,11 @@ ConSrvCloseHandleEntry(PCONSOLE_IO_HANDLE Entry)
WaitAll,
NULL,
(PVOID)Entry);
// TODO: Dereference the notified waits.
if (!IsListEmpty(&InputBuffer->ReadWaitQueue))
{
CsrDereferenceWait(&InputBuffer->ReadWaitQueue);
}
}
/* If the last handle to a screen buffer is closed, delete it... */
@ -498,8 +502,6 @@ ConSrvReleaseConsole(PCONSOLE Console,
ConSrvDeleteConsole(Console);
}
NTSTATUS
NTAPI
ConSrvNewProcess(PCSR_PROCESS SourceProcess,