[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[win-pv-devel] [PATCH 05/14] Add a short Sleep between CreateFile calls



From: Owen Smith <owen.smith@xxxxxxxxxx>

If there is no delay, its possible for the second call to CreateFile
to fail with all pipe instances busy. Give the server end time to
get back to ConnectNamedPipe

Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
---
 src/tty/tty.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/tty/tty.c b/src/tty/tty.c
index 0ed599e..76f4651 100644
--- a/src/tty/tty.c
+++ b/src/tty/tty.c
@@ -413,6 +413,11 @@ _tmain(
     if (Context->Device.Read == INVALID_HANDLE_VALUE)
         ExitProcess(1);
 
+    // add a small delay here, to prevent the second CreateFile returning with
+    // all pipe instances busy - this gives the server end some time to spawn
+    // the read pipe and return to ConnectNamedPipe
+    Sleep(50);
+
     Context->Device.Write = CreateFile(PIPE_NAME,
                                        GENERIC_WRITE,
                                        FILE_SHARE_READ | FILE_SHARE_WRITE,
-- 
2.8.3


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/win-pv-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.