Exemple #1
0
 /// <summary>
 /// Attach a consumer to the producer.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="producer"></param>
 /// <param name="consumer"></param>
 /// <param name="cancellationToken"></param>
 /// <param name="taskCreationOptions"></param>
 /// <param name="taskScheduler"></param>
 /// <returns></returns>
 public static Task <T> Consume <T>(this Func <CancellationToken, Task <T> > producer, Func <T, Task <bool> > consumer, CancellationToken cancellationToken, TaskCreationOptions taskCreationOptions, TaskScheduler taskScheduler)
 {
     return(ProducerConsumer.CreateAsync(producer, consumer, cancellationToken, taskCreationOptions,
                                         taskScheduler));
 }
Exemple #2
0
 /// <summary>
 /// Attach a consumer to the producer.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="producer"></param>
 /// <param name="consumer"></param>
 /// <param name="cancellationToken"></param>
 /// <returns></returns>
 public static Task <T> Consume <T>(this Func <CancellationToken, Task <T> > producer, Func <T, Task <bool> > consumer, CancellationToken cancellationToken)
 {
     return(ProducerConsumer.CreateAsync(producer, consumer, cancellationToken));
 }