From 7b6e1f3953ea51e4206391936f480b0b66f23968 Mon Sep 17 00:00:00 2001 From: amtlib-dot-dll Date: Mon, 13 Feb 2017 21:48:12 +0800 Subject: [PATCH 1/2] Update Container.cs --- src/Microsoft.Windows.ComputeVirtualization/Container.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.Windows.ComputeVirtualization/Container.cs b/src/Microsoft.Windows.ComputeVirtualization/Container.cs index 4e45fe2..83bd4a1 100644 --- a/src/Microsoft.Windows.ComputeVirtualization/Container.cs +++ b/src/Microsoft.Windows.ComputeVirtualization/Container.cs @@ -1,4 +1,4 @@ -using Microsoft.Win32.SafeHandles; +using Microsoft.Win32.SafeHandles; using System; using System.IO; using System.Text; @@ -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 createNewContainer, IHcs hcs = null) { var h = hcs ?? HcsFactory.GetHcs(); var watcher = new HcsNotificationWatcher( @@ -59,7 +59,10 @@ internal static Container Initialize(string id, IntPtr computeSystem, bool termi terminateOnClose, watcher, h); - watcher.Wait(HCS_NOTIFICATIONS.HcsNotificationSystemCreateCompleted); + if (createNewContainer) + { + watcher.Wait(HCS_NOTIFICATIONS.HcsNotificationSystemCreateCompleted); + } return container; } From 7f536d0d541a34ff34f2795a2accad03214de2d0 Mon Sep 17 00:00:00 2001 From: amtlib-dot-dll Date: Mon, 13 Feb 2017 21:49:54 +0800 Subject: [PATCH 2/2] Update HostComputeService.cs --- .../HostComputeService.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.Windows.ComputeVirtualization/HostComputeService.cs b/src/Microsoft.Windows.ComputeVirtualization/HostComputeService.cs index 7ae2a7b..1d930d1 100644 --- a/src/Microsoft.Windows.ComputeVirtualization/HostComputeService.cs +++ b/src/Microsoft.Windows.ComputeVirtualization/HostComputeService.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.ComponentModel; @@ -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 +}