Ejemplo n.º 1
0
        /// <summary>
        /// Determines if we are completely done with this submission and can complete it so the user may access results.
        /// </summary>
        private void CheckForCompletion()
        {
            if (BuildResult != null && LoggingCompleted)
            {
                bool hasCompleted = (Interlocked.Exchange(ref _completionInvoked, 1) == 1);
                if (!hasCompleted)
                {
                    // Did this submission have warnings elevated to errors? If so, mark it as
                    // failed even though it succeeded (with warnings--but they're errors).
                    if (((IBuildComponentHost)BuildManager).LoggingService.HasBuildSubmissionLoggedErrors(BuildResult.SubmissionId))
                    {
                        BuildResult.SetOverallResult(overallResult: false);
                    }

                    _completionEvent.Set();

                    if (_completionCallback != null)
                    {
                        void Callback(object state)
                        {
                            _completionCallback(this);
                        }

                        ThreadPoolExtensions.QueueThreadPoolWorkItemWithCulture(Callback, CultureInfo.CurrentCulture, CultureInfo.CurrentUICulture);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Determines if we are completely done with this submission and can complete it so the user may access results.
        /// </summary>
        private void CheckForCompletion()
        {
            if (BuildResult != null && LoggingCompleted)
            {
                bool hasCompleted = (Interlocked.Exchange(ref _completionInvoked, 1) == 1);
                if (!hasCompleted)
                {
                    _completionEvent.Set();

                    if (null != _completionCallback)
                    {
                        void Callback(object state)
                        {
                            _completionCallback(this);
                        }

                        ThreadPoolExtensions.QueueThreadPoolWorkItemWithCulture(Callback, CultureInfo.CurrentCulture, CultureInfo.CurrentUICulture);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        internal void CompleteResults(GraphBuildResult result)
        {
            ErrorUtilities.VerifyThrowArgumentNull(result, nameof(result));
            ErrorUtilities.VerifyThrow(result.SubmissionId == SubmissionId, "GraphBuildResult's submission id doesn't match GraphBuildSubmission's");

            bool hasCompleted = (Interlocked.Exchange(ref _completionInvoked, 1) == 1);

            if (!hasCompleted)
            {
                BuildResult = result;
                _completionEvent.Set();

                if (_completionCallback != null)
                {
                    void Callback(object state)
                    {
                        _completionCallback(this);
                    }

                    ThreadPoolExtensions.QueueThreadPoolWorkItemWithCulture(Callback, CultureInfo.CurrentCulture, CultureInfo.CurrentUICulture);
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Determines if we are completely done with this submission and can complete it so the user may access results.
        /// </summary>
        private void CheckForCompletion()
        {
            if (BuildResult != null && _loggingCompleted)
            {
                bool hasCompleted = (Interlocked.Exchange(ref _completionInvoked, 1) == 1);
                if (!hasCompleted)
                {
                    _completionEvent.Set();

                    if (null != _completionCallback)
                    {
                        WaitCallback callback = new WaitCallback
                                                (
                            delegate(object state)
                        {
                            _completionCallback(this);
                        });

                        ThreadPoolExtensions.QueueThreadPoolWorkItemWithCulture(callback, Thread.CurrentThread.CurrentCulture, Thread.CurrentThread.CurrentUICulture);
                    }
                }
            }
        }