Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/Microsoft.Windows.ComputeVirtualization/Container.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/// <summary>
Expand All @@ -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);
}
}
}
}