public static Task Run(Action action, ThreadPool tp = null) { Task t = new Task(action); t.RunAsync((tp == null) ? defaultThreadPool : tp); return(t); }
public static Task <TResult> Run(Func <TResult> action) { Task <TResult> t = new Task <TResult>(action); t.RunAsync(); return(t); }
public static Task <TResult> Run(Func <TResult> action, ThreadPool tp = null) { Task <TResult> t = new Task <TResult>(action); t.RunAsync((tp == null) ? defaultThreadPool : tp); return(t); }
/// <summary> /// Queues the specified work to run on the ThreadPool and returns a Task handle for that work. /// </summary> /// <param name="action">The work to execute asynchronously</param> /// <returns>A Task that represents the work queued to execute in the ThreadPool.</returns> /// <exception cref="T:System.ArgumentNullException"> /// The <paramref name="action"/> parameter was null. /// </exception> public static Task Run(Action action) { Task t = new Task(action); t.RunAsync(); return(t); }
public static Task Run(Action action, ThreadPool tp= null) { Task t = new Task(action); t.RunAsync((tp == null) ? defaultThreadPool : tp); return t; }