internal static Container Initialize(string id, IntPtr computeSystem, bool terminateOnClose, bool creatingContainer, IHcs hcs = null) { var h = hcs ?? HcsFactory.GetHcs(); var watcher = new HcsNotificationWatcher( computeSystem, h.RegisterComputeSystemCallback, h.UnregisterComputeSystemCallback, new HCS_NOTIFICATIONS[] { HCS_NOTIFICATIONS.HcsNotificationSystemExited, HCS_NOTIFICATIONS.HcsNotificationSystemCreateCompleted, HCS_NOTIFICATIONS.HcsNotificationSystemStartCompleted } ); var container = new Container( id, computeSystem, terminateOnClose, watcher, h); if (creatingContainer) { watcher.Wait(HCS_NOTIFICATIONS.HcsNotificationSystemCreateCompleted); } return(container); }
internal static Container Initialize(string id, IntPtr computeSystem, bool terminateOnClose) { var watcher = new HcsNotificationWatcher( computeSystem, HcsFunctions.HcsRegisterComputeSystemCallback, HcsFunctions.HcsUnregisterComputeSystemCallback, new HCS_NOTIFICATIONS[] { HCS_NOTIFICATIONS.HcsNotificationSystemExited, HCS_NOTIFICATIONS.HcsNotificationSystemCreateCompleted, HCS_NOTIFICATIONS.HcsNotificationSystemStartCompleted } ); var container = new Container( id, computeSystem, terminateOnClose, watcher); watcher.Wait(HCS_NOTIFICATIONS.HcsNotificationSystemCreateCompleted); return(container); }