コード例 #1
0
ファイル: TaskFactory.cs プロジェクト: microsoft/coyote
        /// <summary>
        /// Creates and starts a task.
        /// </summary>
        public static SystemTask StartNew(SystemTaskFactory factory, Action action, SystemCancellationToken cancellationToken,
                                          SystemTaskCreationOptions creationOptions, SystemTaskScheduler scheduler)
        {
            var runtime = CoyoteRuntime.Current;

            if (runtime.SchedulingPolicy is SchedulingPolicy.None ||
                scheduler.GetType() != SystemTaskScheduler.Default.GetType())
            {
                return(factory.StartNew(action, cancellationToken, creationOptions, scheduler));
            }

            return(runtime.TaskFactory.StartNew(action, cancellationToken,
                                                runtime.TaskFactory.CreationOptions | creationOptions,
                                                runtime.TaskFactory.Scheduler));
        }
コード例 #2
0
ファイル: TaskFactory.cs プロジェクト: microsoft/coyote
        /// <summary>
        /// Creates and starts a task.
        /// </summary>
        public static SystemTasks.Task <TResult> StartNew <TResult>(SystemTaskFactory factory,
                                                                    Func <object, TResult> function, object state, SystemCancellationToken cancellationToken,
                                                                    SystemTaskCreationOptions creationOptions, SystemTaskScheduler scheduler)
        {
            var runtime = CoyoteRuntime.Current;

            if (runtime.SchedulingPolicy is SchedulingPolicy.None ||
                scheduler.GetType() != SystemTaskScheduler.Default.GetType())
            {
                return(factory.StartNew(function, state, cancellationToken, creationOptions, scheduler));
            }

            return(runtime.TaskFactory.StartNew(function, state, cancellationToken,
                                                runtime.TaskFactory.CreationOptions | creationOptions,
                                                runtime.TaskFactory.Scheduler));
        }
コード例 #3
0
ファイル: TaskFactory.cs プロジェクト: microsoft/coyote
 /// <summary>
 /// Creates and starts a task.
 /// </summary>
 public static SystemTasks.Task <TResult> StartNew <TResult>(SystemTaskFactory factory,
                                                             Func <object, TResult> function, object state, SystemTaskCreationOptions creationOptions) =>
 StartNew(factory, function, state, SystemCancellationToken.None, creationOptions,
          SystemTaskScheduler.Default);
コード例 #4
0
ファイル: TaskFactory.cs プロジェクト: microsoft/coyote
 /// <summary>
 /// Creates and starts a task.
 /// </summary>
 public static SystemTask StartNew(SystemTaskFactory factory, Action <object> action, object state,
                                   SystemTaskCreationOptions creationOptions) =>
 StartNew(factory, action, state, SystemCancellationToken.None, creationOptions, SystemTaskScheduler.Default);