[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [win-pv-devel] [PATCH 05/14] Add a short Sleep between CreateFile calls
> -----Original Message----- > From: win-pv-devel [mailto:win-pv-devel-bounces@xxxxxxxxxxxxxxxxxxxx] On > Behalf Of owen.smith@xxxxxxxxxx > Sent: 24 January 2018 14:05 > To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx > Cc: Owen Smith <owen.smith@xxxxxxxxxx> > Subject: [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, I'm not fan of arbitrary delays. Could you handle this by catching the error and retrying instead? Paul > -- > 2.8.3 > > > _______________________________________________ > win-pv-devel mailing list > win-pv-devel@xxxxxxxxxxxxxxxxxxxx > https://lists.xenproject.org/mailman/listinfo/win-pv-devel _______________________________________________ win-pv-devel mailing list win-pv-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/win-pv-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |