From 630c8d5f5688e73335094762f6b224d8484a453e Mon Sep 17 00:00:00 2001 From: Joseph Marsden Date: Mon, 8 Jan 2018 22:17:36 +0000 Subject: [PATCH] Update HostComputeService.cs Update Container.cs --- src/Microsoft.Windows.ComputeVirtualization/Container.cs | 5 +++-- .../HostComputeService.cs | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Microsoft.Windows.ComputeVirtualization/Container.cs b/src/Microsoft.Windows.ComputeVirtualization/Container.cs index 4e45fe2..6eb5f56 100644 --- a/src/Microsoft.Windows.ComputeVirtualization/Container.cs +++ b/src/Microsoft.Windows.ComputeVirtualization/Container.cs @@ -40,7 +40,7 @@ private Container(string id, IntPtr computeSystem, bool terminateOnClose, HcsNot _watcher = watcher; } - internal static Container Initialize(string id, IntPtr computeSystem, bool terminateOnClose, IHcs hcs = null) + internal static Container Initialize(string id, IntPtr computeSystem, bool terminateOnClose, bool creatingContainer, IHcs hcs = null) { var h = hcs ?? HcsFactory.GetHcs(); var watcher = new HcsNotificationWatcher( @@ -59,7 +59,8 @@ internal static Container Initialize(string id, IntPtr computeSystem, bool termi terminateOnClose, watcher, h); - watcher.Wait(HCS_NOTIFICATIONS.HcsNotificationSystemCreateCompleted); + if (creatingContainer) + watcher.Wait(HCS_NOTIFICATIONS.HcsNotificationSystemCreateCompleted); return container; } diff --git a/src/Microsoft.Windows.ComputeVirtualization/HostComputeService.cs b/src/Microsoft.Windows.ComputeVirtualization/HostComputeService.cs index 7ae2a7b..ed395d6 100644 --- a/src/Microsoft.Windows.ComputeVirtualization/HostComputeService.cs +++ b/src/Microsoft.Windows.ComputeVirtualization/HostComputeService.cs @@ -141,7 +141,7 @@ public static Container CreateContainer(string id, ContainerSettings settings, I IntPtr computeSystem; h.CreateComputeSystem(id, JsonHelper.ToJson(hcsSettings), IntPtr.Zero, out computeSystem); - return Container.Initialize(id, computeSystem, settings.KillOnClose, h); + return Container.Initialize(id, computeSystem, settings.KillOnClose, true, h); } /// @@ -155,7 +155,7 @@ public static Container GetComputeSystem(string id, IHcs hcs = null) var h = hcs ?? HcsFactory.GetHcs(); h.OpenComputeSystem(id, out computeSystem); - return Container.Initialize(id, computeSystem, false, h); + return Container.Initialize(id, computeSystem, false, false, h); } } -} \ No newline at end of file +}