Пример #1
0
        /// <summary>
        /// Tries to stop the execution of PlanetLab commands.
        /// </summary>
        /// <param name="state">The manager state.</param>
        /// <param name="action">The action to take after execution was stopped.</param>
        private void TryStop(PlManagerState state, Action action)
        {
            // Execute on the thread pool.
            ThreadPool.QueueUserWorkItem((object threadState) =>
                {
                    // Stop the manager execution.
                    state.Stop();

                    // Wait for the manager execution to complete.
                    state.WaitStop();

                    // Execute the action.
                    action();
                });
        }