Beispiel #1
0
 public Task Run()
 {
     Parallel.Invoke(new ParallelOptions {
         MaxDegreeOfParallelism = 4
     },
                     () => CpuBound.Compute(10),
                     () => CpuBound.Compute(11),
                     () => CpuBound.Compute(12),
                     () => CpuBound.Compute(13),
                     () => CpuBound.Compute(14),
                     () => CpuBound.Compute(15)
                     );
     return(Task.CompletedTask);
 }
Beispiel #2
0
 public Task Run()
 {
     return(Task.Factory.StartNew(() => CpuBound.Compute(10), CancellationToken.None, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default));
 }
 public Task Run()
 {
     return(Task.Run(() => CpuBound.Compute(10)));
 }