Esempio n. 1
0
        public static bool TryCancelScope(this tTask task)
        {
            if (task.IsCanceled)
            {
                return(true);
            }
            else if (task.IsCompleted)
            {
                return(false);
            }

            CancellationScope scope;

            if (CancellationScope.TryGet(task, out scope))
            {
                return(scope.TryCancel());
            }

            return(false);
        }