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);
        }
 private Container(string id, IntPtr computeSystem, bool terminateOnClose, HcsNotificationWatcher watcher, IHcs hcs)
 {
     _hcs         = hcs;
     _killOnClose = terminateOnClose;
     _cs          = computeSystem;
     _watcher     = watcher;
 }
 internal Process(IntPtr process, StreamWriter stdin, StreamReader stdout, StreamReader stderr, bool killOnClose)
 {
     _p           = process;
     _stdin       = stdin;
     _stdout      = stdout;
     _stderr      = stderr;
     _killOnClose = killOnClose;
     _watcher     = new HcsNotificationWatcher(
         _p,
         HcsFunctions.HcsRegisterProcessCallback,
         HcsFunctions.HcsUnregisterProcessCallback,
         new HCS_NOTIFICATIONS[] {
         HCS_NOTIFICATIONS.HcsNotificationProcessExited
     }
         );
 }
Beispiel #4
0
        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);
        }