예제 #1
0
            /// <summary>
            /// Invokes progress callbacks for all promises that had their progress updated,
            /// then if <see cref="Config.UncaughtRejectionHandler"/> is not null, invokes it with each unhandled rejection,
            /// otherwise throws all unhandled rejections as <see cref="AggregateException"/>.
            /// <para/>Does nothing if progress is already being handled or if progress is disabled.
            /// </summary>
            public static void HandleProgress()
            {
                ValidateThreadAccess(1, false);

                bool willThrow = _willThrow;

                _willThrow = true;

                InvokeProgressListeners();

                if (!willThrow)
                {
                    _willThrow = false;
                    Internal.ThrowUnhandledRejections();
                }
            }
예제 #2
0
            /// <summary>
            /// Invokes callbacks for completed promises,
            /// then if <see cref="Config.UncaughtRejectionHandler"/> is not null, invokes it with each unhandled rejection,
            /// otherwise throws all unhandled rejections as <see cref="AggregateException"/>.
            /// <para/>Does nothing if completes are already being handled.
            /// </summary>
            public static void HandleCompletes()
            {
                ValidateThreadAccess(1, false);

                bool willThrow = _willThrow;

                _willThrow = true;

                Internal.HandleEvents();

                if (!willThrow)
                {
                    _willThrow = false;
                    Internal.ThrowUnhandledRejections();
                }
            }