mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[SERIAL] Immediately complete read IRP if all requested bytes have been found in circular buffer
Previously, we had to wait to receive another byte to finish the first IRP.
This commit is contained in:
parent
ebd39aa266
commit
bef39dd62e
1 changed files with 7 additions and 1 deletions
|
@ -65,7 +65,7 @@ ReadBytes(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* while buffer is not fully filled */
|
/* while buffer is not fully filled */
|
||||||
while (Length > 0)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
/* read already received bytes from buffer */
|
/* read already received bytes from buffer */
|
||||||
KeAcquireSpinLock(&DeviceExtension->InputBufferLock, &Irql);
|
KeAcquireSpinLock(&DeviceExtension->InputBufferLock, &Irql);
|
||||||
|
@ -81,6 +81,12 @@ ReadBytes(
|
||||||
KeClearEvent(&DeviceExtension->InputBufferNotEmpty);
|
KeClearEvent(&DeviceExtension->InputBufferNotEmpty);
|
||||||
KeReleaseSpinLock(&DeviceExtension->InputBufferLock, Irql);
|
KeReleaseSpinLock(&DeviceExtension->InputBufferLock, Irql);
|
||||||
|
|
||||||
|
if (Length == 0)
|
||||||
|
{
|
||||||
|
INFO_(SERIAL, "All bytes read\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (WorkItemData->DontWait
|
if (WorkItemData->DontWait
|
||||||
&& !(WorkItemData->ReadAtLeastOneByte && Information == 0))
|
&& !(WorkItemData->ReadAtLeastOneByte && Information == 0))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue