Example #1
0
        public Task <TNewResult> ContinueWith <TNewResult> (Func <Task <TResult>, object, TNewResult> continuationFunction, object state,
                                                            CancellationToken cancellationToken,
                                                            TaskContinuationOptions continuationOptions,
                                                            TaskScheduler scheduler)
        {
            if (continuationFunction == null)
            {
                throw new ArgumentNullException("continuationFunction");
            }
            if (scheduler == null)
            {
                throw new ArgumentNullException("scheduler");
            }

            var t = new Task <TNewResult> (TaskActionInvoker.Create(continuationFunction),
                                           state,
                                           cancellationToken,
                                           GetCreationOptions(continuationOptions),
                                           null,
                                           this);

            ContinueWithCore(t, continuationOptions, scheduler);

            return(t);
        }
Example #2
0
 public Task(Func <TResult> function, CancellationToken cancellationToken, TaskCreationOptions creationOptions)
     : base(TaskActionInvoker.Create(function), null, cancellationToken, creationOptions)
 {
     if (function == null)
     {
         throw new ArgumentNullException("function");
     }
 }
Example #3
0
		public Task (Action<object> action, object state, CancellationToken cancellationToken, TaskCreationOptions creationOptions)
			: this (TaskActionInvoker.Create (action), state, cancellationToken, creationOptions, current)
		{
			if (action == null)
				throw new ArgumentNullException ("action");
			if (creationOptions > MaxTaskCreationOptions || creationOptions < TaskCreationOptions.None)
				throw new ArgumentOutOfRangeException ("creationOptions");
		}
Example #4
0
		public Task ContinueWith (Action<Task> continuationAction, CancellationToken cancellationToken, TaskContinuationOptions continuationOptions, TaskScheduler scheduler)
		{
			if (continuationAction == null)
				throw new ArgumentNullException ("continuationAction");
			if (scheduler == null)
				throw new ArgumentNullException ("scheduler");

			return ContinueWith (TaskActionInvoker.Create (continuationAction), cancellationToken, continuationOptions, scheduler);
		}
Example #5
0
 public Task(Action action, CancellationToken cancellationToken, TaskCreationOptions creationOptions)
     : this(TaskActionInvoker.Create(action), null, cancellationToken, creationOptions, current.Get())
 {
     if (action == null)
     {
         throw new ArgumentNullException("action");
     }
     if (creationOptions > MaxTaskCreationOptions || creationOptions < TaskCreationOptions.None)
     {
         throw new ArgumentOutOfRangeException("creationOptions");
     }
 }
Example #6
0
        public Task <TResult> ContinueWith <TResult> (Func <Task, TResult> continuationFunction, CancellationToken cancellationToken,
                                                      TaskContinuationOptions continuationOptions, TaskScheduler scheduler)
        {
            if (continuationFunction == null)
            {
                throw new ArgumentNullException("continuationFunction");
            }
            if (scheduler == null)
            {
                throw new ArgumentNullException("scheduler");
            }

            return(ContinueWith <TResult> (TaskActionInvoker.Create(continuationFunction), cancellationToken, continuationOptions, scheduler));
        }
Example #7
0
		Task ContinueWith (Action<Task, object> continuationAction, object state, CancellationToken cancellationToken,
								  TaskContinuationOptions continuationOptions, TaskScheduler scheduler)
		{
			if (continuationAction == null)
				throw new ArgumentNullException ("continuationAction");
			if (scheduler == null)
				throw new ArgumentNullException ("scheduler");

			Task continuation = new Task (TaskActionInvoker.Create (continuationAction),
										  state, cancellationToken,
										  GetCreationOptions (continuationOptions),
			                              parent,
			                              this);
			ContinueWithCore (continuation, continuationOptions, scheduler);

			return continuation;
		}
Example #8
0
        public Task ContinueWith(Action <Task <TResult> > continuationAction, CancellationToken cancellationToken,
                                 TaskContinuationOptions continuationOptions, TaskScheduler scheduler)
        {
            if (continuationAction == null)
            {
                throw new ArgumentNullException("continuationAction");
            }
            if (scheduler == null)
            {
                throw new ArgumentNullException("scheduler");
            }

            Task t = new Task(TaskActionInvoker.Create(continuationAction),
                              null,
                              cancellationToken,
                              GetCreationOptions(continuationOptions),
                              this);

            ContinueWithCore(t, continuationOptions, scheduler);

            return(t);
        }
Example #9
0
		protected void SetAction (Action<object> action)
		{
			this.invoker = TaskActionInvoker.Create(action);
		}