6 // Jérémie "Garuma" Laval <jeremie.laval@gmail.com>
8 // Copyright (c) 2009 Jérémie "Garuma" Laval
10 // Permission is hereby granted, free of charge, to any person obtaining a copy
11 // of this software and associated documentation files (the "Software"), to deal
12 // in the Software without restriction, including without limitation the rights
13 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 // copies of the Software, and to permit persons to whom the Software is
15 // furnished to do so, subject to the following conditions:
17 // The above copyright notice and this permission notice shall be included in
18 // all copies or substantial portions of the Software.
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
29 using System
.Threading
;
31 namespace System
.Threading
.Tasks
34 public class TaskFactory
36 TaskScheduler scheduler
;
37 TaskCreationOptions options
;
38 TaskContinuationOptions contOptions
;
41 public TaskFactory () : this (TaskScheduler
.Current
, TaskCreationOptions
.None
, TaskContinuationOptions
.None
)
45 public TaskFactory (TaskScheduler scheduler
) : this (scheduler
, TaskCreationOptions
.None
, TaskContinuationOptions
.None
)
49 public TaskFactory (TaskCreationOptions options
, TaskContinuationOptions contOptions
)
50 : this (TaskScheduler
.Current
, options
, contOptions
)
54 public TaskFactory (TaskScheduler scheduler
, TaskCreationOptions options
, TaskContinuationOptions contOptions
)
56 this.scheduler
= scheduler
;
57 this.options
= options
;
58 this.contOptions
= contOptions
;
62 #region StartNew for Task
63 public Task
StartNew (Action action
)
65 return StartNew (action
, options
, scheduler
);
68 public Task
StartNew (Action action
, TaskCreationOptions options
)
70 return StartNew (action
, options
, scheduler
);
73 public Task
StartNew (Action action
, TaskCreationOptions options
, TaskScheduler scheduler
)
75 return StartNew ((o
) => action (), null, options
, scheduler
);
78 public Task
StartNew (Action
<object> action
, object state
)
80 return StartNew (action
, state
, options
, scheduler
);
83 public Task
StartNew (Action
<object> action
, object state
, TaskCreationOptions options
)
85 return StartNew (action
, state
, options
, scheduler
);
88 public Task
StartNew (Action
<object> action
, object state
, TaskCreationOptions options
, TaskScheduler scheduler
)
90 Task t
= new Task (action
, state
, options
);
97 #region StartNew for Task<TResult>
98 public Task
<TResult
> StartNew
<TResult
> (Func
<TResult
> function
)
100 return StartNew
<TResult
> (function
, options
, scheduler
);
103 public Task
<TResult
> StartNew
<TResult
> (Func
<TResult
> function
, TaskCreationOptions options
)
105 return StartNew
<TResult
> (function
, options
, scheduler
);
108 public Task
<TResult
> StartNew
<TResult
> (Func
<TResult
> function
, TaskCreationOptions options
, TaskScheduler scheduler
)
110 return StartNew
<TResult
> ((o
) => function (), null, options
, scheduler
);
113 public Task
<TResult
> StartNew
<TResult
> (Func
<object, TResult
> function
, object state
)
115 return StartNew
<TResult
> (function
, state
, options
, scheduler
);
118 public Task
<TResult
> StartNew
<TResult
> (Func
<object, TResult
> function
, object state
, TaskCreationOptions options
)
120 return StartNew
<TResult
> (function
, state
, options
, scheduler
);
123 public Task
<TResult
> StartNew
<TResult
> (Func
<object, TResult
> function
, object state
, TaskCreationOptions options
,
124 TaskScheduler scheduler
)
126 Task
<TResult
> t
= new Task
<TResult
> (function
, state
, options
);
136 public Task
ContinueWhenAny (Task
[] tasks
, Action
<Task
> continuationAction
)
138 return ContinueWhenAny (tasks
, continuationAction
, contOptions
, scheduler
);
142 public Task
ContinueWhenAny (Task
[] tasks
, Action
<Task
> continuationAction
, TaskContinuationOptions continuationOptions
)
144 return ContinueWhenAny (tasks
, continuationAction
, continuationOptions
, scheduler
);
148 public Task
ContinueWhenAny (Task
[] tasks
, Action
<Task
> continuationAction
, TaskContinuationOptions continuationOptions
,
149 TaskScheduler scheduler
)
151 throw new NotImplementedException ();
155 public Task
<TResult
> ContinueWhenAny
<TResult
> (Task
[] tasks
, Func
<Task
, TResult
> continuationAction
)
157 return ContinueWhenAny (tasks
, continuationAction
, contOptions
);
161 public Task
<TResult
> ContinueWhenAny
<TResult
> (Task
[] tasks
, Func
<Task
, TResult
> continuationAction
,
162 TaskContinuationOptions continuationOptions
)
164 return ContinueWhenAny (tasks
, continuationAction
, continuationOptions
, scheduler
);
168 public Task
<TResult
> ContinueWhenAny
<TResult
> (Task
[] tasks
, Func
<Task
, TResult
> continuationAction
,
169 TaskContinuationOptions continuationOptions
,
170 TaskScheduler scheduler
)
172 throw new NotImplementedException ();
175 public Task
ContinueWhenAll (Task
[] tasks
, Action
<Task
[]> continuationFunction
)
177 return ContinueWhenAll (tasks
, continuationFunction
, contOptions
);
180 public Task
ContinueWhenAll (Task
[] tasks
, Action
<Task
[]> continuationFunction
,
181 TaskContinuationOptions continuationOptions
)
183 return ContinueWhenAll (tasks
, continuationFunction
, continuationOptions
, scheduler
);
186 public Task
ContinueWhenAll (Task
[] tasks
, Action
<Task
[]> continuationFunction
,
187 TaskContinuationOptions continuationOptions
, TaskScheduler scheduler
)
189 CountdownEvent evt
= new CountdownEvent (tasks
.Length
);
190 Task cont
= new Task ((o
) => continuationFunction ((Task
[])o
), tasks
, options
);
192 foreach (Task t
in tasks
)
193 t
.ContinueWithCore (cont
, continuationOptions
, scheduler
, evt
.Signal
);
199 public Task
<TResult
> ContinueWhenAll
<TResult
> (Task
[] tasks
, Func
<Task
[], TResult
> continuationFunction
)
201 return ContinueWhenAll
<TResult
> (tasks
, continuationFunction
, contOptions
);
204 public Task
<TResult
> ContinueWhenAll
<TResult
> (Task
[] tasks
, Func
<Task
[], TResult
> continuationFunction
,
205 TaskContinuationOptions continuationOptions
)
207 return ContinueWhenAll
<TResult
> (tasks
, continuationFunction
, continuationOptions
, scheduler
);
210 public Task
<TResult
> ContinueWhenAll
<TResult
> (Task
[] tasks
, Func
<Task
[], TResult
> continuationFunction
,
211 TaskContinuationOptions continuationOptions
, TaskScheduler scheduler
)
213 CountdownEvent evt
= new CountdownEvent (tasks
.Length
);
214 Task
<TResult
> cont
= new Task
<TResult
> ((o
) => continuationFunction ((Task
[])o
), tasks
, options
);
216 foreach (Task t
in tasks
)
217 t
.ContinueWithCore (cont
, continuationOptions
, scheduler
, evt
.Signal
);
225 // For these methods to work we first have to convert the ThreadPool to use Tasks as it
226 // is doing in 4.0, then all that is remaining is to identify the Task on which is
227 // run the async operation (probably with some additional state in a IAsyncResult subclass)
228 // and call its ContinueWith method accordingly
230 const string errorMsg
= "Mono's thread pool doesn't support this operation yet";
232 [MonoLimitation(errorMsg
)]
233 public Task
FromAsync (IAsyncResult asyncResult
, Action
<IAsyncResult
> endMethod
)
235 return FromAsync (asyncResult
, endMethod
, options
);
238 [MonoLimitation(errorMsg
)]
239 public Task
FromAsync (IAsyncResult asyncResult
, Action
<IAsyncResult
> endMethod
,
240 TaskCreationOptions creationOptions
)
242 return FromAsync (asyncResult
, endMethod
, creationOptions
);
245 [MonoLimitation(errorMsg
)]
246 public Task
FromAsync (IAsyncResult asyncResult
, Action
<IAsyncResult
> endMethod
,
247 TaskCreationOptions creationOptions
, TaskScheduler scheduler
)
249 throw new NotSupportedException (errorMsg
);
252 [MonoLimitation(errorMsg
)]
253 public Task
<TResult
> FromAsync
<TResult
> (IAsyncResult asyncResult
, Func
<IAsyncResult
, TResult
> endMethod
)
255 return FromAsync
<TResult
> (asyncResult
, endMethod
, options
);
258 [MonoLimitation(errorMsg
)]
259 public Task
<TResult
> FromAsync
<TResult
> (IAsyncResult asyncResult
, Func
<IAsyncResult
, TResult
> endMethod
,
260 TaskCreationOptions creationOptions
)
262 return FromAsync
<TResult
> (asyncResult
, endMethod
, creationOptions
);
265 [MonoLimitation(errorMsg
)]
266 public Task
<TResult
> FromAsync
<TResult
> (IAsyncResult asyncResult
, Func
<IAsyncResult
, TResult
> endMethod
,
267 TaskCreationOptions creationOptions
, TaskScheduler scheduler
)
269 throw new NotSupportedException (errorMsg
);
273 [MonoLimitation(errorMsg
)]
274 public Task
FromAsync (Func
<AsyncCallback
, Object
, IAsyncResult
> beginMethod
, Action
<IAsyncResult
> endMethod
,
277 return FromAsync
<object> ((a
, c
, o
) => beginMethod (c
, o
), endMethod
, state
, options
);
280 [MonoLimitation(errorMsg
)]
281 public Task
FromAsync (Func
<AsyncCallback
, Object
, IAsyncResult
> beginMethod
, Action
<IAsyncResult
> endMethod
,
282 object state
, TaskCreationOptions creationOptions
)
284 return FromAsync
<object> ((a
, c
, o
) => beginMethod (c
, o
), endMethod
, state
, creationOptions
);
287 [MonoLimitation(errorMsg
)]
288 public Task FromAsync
<TArg1
> (Func
<TArg1
, AsyncCallback
, Object
, IAsyncResult
> beginMethod
, Action
<IAsyncResult
> endMethod
,
289 TArg1 arg1
, object state
)
291 throw new NotSupportedException (errorMsg
);
294 [MonoLimitation(errorMsg
)]
295 public Task FromAsync
<TArg1
> (Func
<TArg1
, AsyncCallback
, Object
, IAsyncResult
> beginMethod
, Action
<IAsyncResult
> endMethod
,
296 TArg1 arg1
, object state
, TaskCreationOptions creationOptions
)
298 throw new NotSupportedException (errorMsg
);
301 [MonoLimitation(errorMsg
)]
302 public Task FromAsync
<TArg1
, TArg2
> (Func
<TArg1
, TArg2
, AsyncCallback
, Object
, IAsyncResult
> beginMethod
, Action
<IAsyncResult
> endMethod
,
303 TArg1 arg1
, TArg2 arg2
, object state
)
305 throw new NotSupportedException (errorMsg
);
308 [MonoLimitation(errorMsg
)]
309 public Task FromAsync
<TArg1
, TArg2
> (Func
<TArg1
, TArg2
, AsyncCallback
, Object
, IAsyncResult
> beginMethod
, Action
<IAsyncResult
> endMethod
,
310 TArg1 arg1
, TArg2 arg2
, object state
, TaskCreationOptions creationOptions
)
312 throw new NotSupportedException (errorMsg
);
315 [MonoLimitation(errorMsg
)]
316 public Task FromAsync
<TArg1
, TArg2
, TArg3
> (Func
<TArg1
, TArg2
, TArg3
, AsyncCallback
, Object
, IAsyncResult
> beginMethod
, Action
<IAsyncResult
> endMethod
,
317 TArg1 arg1
, TArg2 arg2
, TArg3 arg3
, object state
)
319 throw new NotSupportedException (errorMsg
);
322 [MonoLimitation(errorMsg
)]
323 public Task FromAsync
<TArg1
, TArg2
, TArg3
> (Func
<TArg1
, TArg2
, TArg3
, AsyncCallback
, Object
, IAsyncResult
> beginMethod
, Action
<IAsyncResult
> endMethod
,
324 TArg1 arg1
, TArg2 arg2
, TArg3 arg3
, object state
, TaskCreationOptions creationOptions
)
326 throw new NotSupportedException (errorMsg
);
329 [MonoLimitation(errorMsg
)]
330 public Task
<TResult
> FromAsync
<TResult
> (Func
<AsyncCallback
, Object
, IAsyncResult
> beginMethod
,
331 Func
<IAsyncResult
, TResult
> endMethod
,
334 throw new NotSupportedException (errorMsg
);
337 [MonoLimitation(errorMsg
)]
338 public Task
<TResult
> FromAsync
<TResult
> (Func
<AsyncCallback
, Object
, IAsyncResult
> beginMethod
,
339 Func
<IAsyncResult
, TResult
> endMethod
,
340 object state
, TaskCreationOptions creationOptions
)
342 throw new NotSupportedException (errorMsg
);
345 [MonoLimitation(errorMsg
)]
346 public Task
<TResult
> FromAsync
<TArg1
, TResult
> (Func
<TArg1
, AsyncCallback
, Object
, IAsyncResult
> beginMethod
,
347 Func
<IAsyncResult
, TResult
> endMethod
,
348 TArg1 arg1
, object state
)
350 throw new NotSupportedException (errorMsg
);
353 [MonoLimitation(errorMsg
)]
354 public Task
<TResult
> FromAsync
<TArg1
, TResult
> (Func
<TArg1
, AsyncCallback
, Object
, IAsyncResult
> beginMethod
,
355 Func
<IAsyncResult
, TResult
> endMethod
,
356 TArg1 arg1
, object state
, TaskCreationOptions creationOptions
)
358 throw new NotSupportedException (errorMsg
);
361 [MonoLimitation(errorMsg
)]
362 public Task
<TResult
> FromAsync
<TArg1
, TArg2
, TResult
> (Func
<TArg1
, TArg2
, AsyncCallback
, Object
, IAsyncResult
> beginMethod
,
363 Func
<IAsyncResult
, TResult
> endMethod
,
364 TArg1 arg1
, TArg2 arg2
, object state
)
366 throw new NotSupportedException (errorMsg
);
369 [MonoLimitation(errorMsg
)]
370 public Task
<TResult
> FromAsync
<TArg1
, TArg2
, TResult
> (Func
<TArg1
, TArg2
, AsyncCallback
, Object
, IAsyncResult
> beginMethod
,
371 Func
<IAsyncResult
, TResult
> endMethod
,
372 TArg1 arg1
, TArg2 arg2
, object state
, TaskCreationOptions creationOptions
)
374 throw new NotSupportedException (errorMsg
);
377 [MonoLimitation(errorMsg
)]
378 public Task
<TResult
> FromAsync
<TArg1
, TArg2
, TArg3
, TResult
> (Func
<TArg1
, TArg2
, TArg3
, AsyncCallback
, Object
, IAsyncResult
> beginMethod
,
379 Func
<IAsyncResult
, TResult
> endMethod
,
380 TArg1 arg1
, TArg2 arg2
, TArg3 arg3
, object state
)
382 throw new NotSupportedException (errorMsg
);
385 [MonoLimitation(errorMsg
)]
386 public Task
<TResult
> FromAsync
<TArg1
, TArg2
, TArg3
, TResult
> (Func
<TArg1
, TArg2
, TArg3
, AsyncCallback
, Object
, IAsyncResult
> beginMethod
,
387 Func
<IAsyncResult
, TResult
> endMethod
,
388 TArg1 arg1
, TArg2 arg2
, TArg3 arg3
, object state
,
389 TaskCreationOptions creationOptions
)
391 throw new NotSupportedException (errorMsg
);
395 public TaskScheduler Scheduler
{
401 public TaskContinuationOptions ContinuationOptions
{
407 public TaskCreationOptions CreationOptions
{
414 public class TaskFactory
<TResult
>
416 TaskScheduler scheduler
;
417 TaskCreationOptions options
;
418 TaskContinuationOptions contOptions
;
423 public TaskFactory () : this (TaskScheduler
.Current
, TaskCreationOptions
.None
, TaskContinuationOptions
.None
)
427 public TaskFactory (TaskScheduler scheduler
) : this (scheduler
, TaskCreationOptions
.None
, TaskContinuationOptions
.None
)
431 public TaskFactory (TaskCreationOptions options
, TaskContinuationOptions contOptions
)
432 : this (TaskScheduler
.Current
, options
, contOptions
)
436 public TaskFactory (TaskScheduler scheduler
, TaskCreationOptions options
, TaskContinuationOptions contOptions
)
438 this.scheduler
= scheduler
;
439 this.options
= options
;
440 this.contOptions
= contOptions
;
441 this.parent
= new TaskFactory (scheduler
, options
, contOptions
);
445 #region StartNew for Task<TResult>
446 public Task
<TResult
> StartNew (Func
<TResult
> function
)
448 return StartNew (function
, options
, scheduler
);
451 public Task
<TResult
> StartNew (Func
<TResult
> function
, TaskCreationOptions options
)
453 return StartNew (function
, options
, scheduler
);
456 public Task
<TResult
> StartNew (Func
<TResult
> function
, TaskCreationOptions options
, TaskScheduler scheduler
)
458 return StartNew ((o
) => function (), null, options
, scheduler
);
461 public Task
<TResult
> StartNew (Func
<object, TResult
> function
, object state
)
463 return StartNew (function
, state
, options
, scheduler
);
466 public Task
<TResult
> StartNew (Func
<object, TResult
> function
, object state
, TaskCreationOptions options
)
468 return StartNew (function
, state
, options
, scheduler
);
471 public Task
<TResult
> StartNew (Func
<object, TResult
> function
, object state
, TaskCreationOptions options
,
472 TaskScheduler scheduler
)
474 return parent
.StartNew
<TResult
> (function
, state
, options
, scheduler
);
480 public Task
ContinueWhenAny (Task
<TResult
>[] tasks
, Action
<Task
<TResult
>> continuationAction
)
482 return ContinueWhenAny (tasks
, continuationAction
, contOptions
, scheduler
);
486 public Task
ContinueWhenAny (Task
<TResult
>[] tasks
, Action
<Task
<TResult
>> continuationAction
,
487 TaskContinuationOptions continuationOptions
)
489 return ContinueWhenAny (tasks
, continuationAction
, continuationOptions
, scheduler
);
493 public Task
ContinueWhenAny (Task
<TResult
>[] tasks
, Action
<Task
<TResult
>> continuationAction
,
494 TaskContinuationOptions continuationOptions
,
495 TaskScheduler scheduler
)
497 throw new NotImplementedException ();
501 public Task
<TNewResult
> ContinueWhenAny
<TNewResult
> (Task
<TResult
>[] tasks
, Func
<Task
<TResult
>, TNewResult
> continuationAction
)
503 return ContinueWhenAny (tasks
, continuationAction
, contOptions
);
507 public Task
<TNewResult
> ContinueWhenAny
<TNewResult
> (Task
<TResult
>[] tasks
, Func
<Task
<TResult
>, TNewResult
> continuationAction
,
508 TaskContinuationOptions continuationOptions
)
510 return ContinueWhenAny (tasks
, continuationAction
, continuationOptions
, scheduler
);
514 public Task
<TNewResult
> ContinueWhenAny
<TNewResult
> (Task
<TResult
>[] tasks
, Func
<Task
<TResult
>, TNewResult
> continuationAction
,
515 TaskContinuationOptions continuationOptions
,
516 TaskScheduler scheduler
)
518 throw new NotImplementedException ();
521 public Task
ContinueWhenAll (Task
<TResult
>[] tasks
, Action
<Task
<TResult
>[]> continuationFunction
)
523 return ContinueWhenAll (tasks
, continuationFunction
, contOptions
);
526 public Task
ContinueWhenAll (Task
<TResult
>[] tasks
, Action
<Task
<TResult
>[]> continuationFunction
,
527 TaskContinuationOptions continuationOptions
)
529 return ContinueWhenAll (tasks
, continuationFunction
, continuationOptions
, scheduler
);
532 public Task
ContinueWhenAll (Task
<TResult
>[] tasks
, Action
<Task
<TResult
>[]> continuationFunction
,
533 TaskContinuationOptions continuationOptions
, TaskScheduler scheduler
)
535 CountdownEvent evt
= new CountdownEvent (tasks
.Length
);
536 Task cont
= new Task ((o
) => continuationFunction ((Task
<TResult
>[])o
), tasks
, options
);
538 foreach (Task t
in tasks
)
539 t
.ContinueWithCore (cont
, continuationOptions
, scheduler
, evt
.Signal
);
544 public Task
<TNewResult
> ContinueWhenAll
<TNewResult
> (Task
<TResult
>[] tasks
,
545 Func
<Task
<TResult
>[], TNewResult
> continuationFunction
)
547 return ContinueWhenAll (tasks
, continuationFunction
, contOptions
);
550 public Task
<TNewResult
> ContinueWhenAll
<TNewResult
> (Task
<TResult
>[] tasks
,
551 Func
<Task
<TResult
>[], TNewResult
> continuationFunction
,
552 TaskContinuationOptions continuationOptions
)
554 return ContinueWhenAll (tasks
, continuationFunction
, continuationOptions
, scheduler
);
557 public Task
<TNewResult
> ContinueWhenAll
<TNewResult
> (Task
<TResult
>[] tasks
,
558 Func
<Task
<TResult
>[], TNewResult
> continuationFunction
,
559 TaskContinuationOptions continuationOptions
, TaskScheduler scheduler
)
561 CountdownEvent evt
= new CountdownEvent (tasks
.Length
);
562 Task
<TNewResult
> cont
= new Task
<TNewResult
> ((o
) => continuationFunction ((Task
<TResult
>[])o
), tasks
, options
);
564 foreach (Task t
in tasks
)
565 t
.ContinueWithCore (cont
, continuationOptions
, scheduler
, evt
.Signal
);
573 const string errorMsg
= "Mono's thread pool doesn't support this operation yet";
575 [MonoLimitation(errorMsg
)]
576 public Task
<TResult
> FromAsync (IAsyncResult asyncResult
, Func
<IAsyncResult
, TResult
> endMethod
)
578 return FromAsync (asyncResult
, endMethod
, options
);
581 [MonoLimitation(errorMsg
)]
582 public Task
<TResult
> FromAsync (IAsyncResult asyncResult
, Func
<IAsyncResult
, TResult
> endMethod
,
583 TaskCreationOptions creationOptions
)
585 return FromAsync (asyncResult
, endMethod
, creationOptions
);
588 [MonoLimitation(errorMsg
)]
589 public Task
<TResult
> FromAsync (IAsyncResult asyncResult
, Func
<IAsyncResult
, TResult
> endMethod
,
590 TaskCreationOptions creationOptions
, TaskScheduler scheduler
)
592 throw new NotSupportedException (errorMsg
);
595 [MonoLimitation(errorMsg
)]
596 public Task
<TResult
> FromAsync (Func
<AsyncCallback
, Object
, IAsyncResult
> beginMethod
,
597 Func
<IAsyncResult
, TResult
> endMethod
,
600 throw new NotSupportedException (errorMsg
);
603 [MonoLimitation(errorMsg
)]
604 public Task
<TResult
> FromAsync (Func
<AsyncCallback
, Object
, IAsyncResult
> beginMethod
,
605 Func
<IAsyncResult
, TResult
> endMethod
,
606 object state
, TaskCreationOptions creationOptions
)
608 throw new NotSupportedException (errorMsg
);
611 [MonoLimitation(errorMsg
)]
612 public Task
<TResult
> FromAsync
<TArg1
> (Func
<TArg1
, AsyncCallback
, Object
, IAsyncResult
> beginMethod
,
613 Func
<IAsyncResult
, TResult
> endMethod
,
614 TArg1 arg1
, object state
)
616 throw new NotSupportedException (errorMsg
);
619 [MonoLimitation(errorMsg
)]
620 public Task
<TResult
> FromAsync
<TArg1
> (Func
<TArg1
, AsyncCallback
, Object
, IAsyncResult
> beginMethod
,
621 Func
<IAsyncResult
, TResult
> endMethod
,
622 TArg1 arg1
, object state
, TaskCreationOptions creationOptions
)
624 throw new NotSupportedException (errorMsg
);
627 [MonoLimitation(errorMsg
)]
628 public Task
<TResult
> FromAsync
<TArg1
, TArg2
> (Func
<TArg1
, TArg2
, AsyncCallback
, Object
, IAsyncResult
> beginMethod
,
629 Func
<IAsyncResult
, TResult
> endMethod
,
630 TArg1 arg1
, TArg2 arg2
, object state
)
632 throw new NotSupportedException (errorMsg
);
635 [MonoLimitation(errorMsg
)]
636 public Task
<TResult
> FromAsync
<TArg1
, TArg2
> (Func
<TArg1
, TArg2
, AsyncCallback
, Object
, IAsyncResult
> beginMethod
,
637 Func
<IAsyncResult
, TResult
> endMethod
,
638 TArg1 arg1
, TArg2 arg2
, object state
, TaskCreationOptions creationOptions
)
640 throw new NotSupportedException (errorMsg
);
643 [MonoLimitation(errorMsg
)]
644 public Task
<TResult
> FromAsync
<TArg1
, TArg2
, TArg3
> (Func
<TArg1
, TArg2
, TArg3
, AsyncCallback
, Object
, IAsyncResult
> beginMethod
,
645 Func
<IAsyncResult
, TResult
> endMethod
,
646 TArg1 arg1
, TArg2 arg2
, TArg3 arg3
, object state
)
648 throw new NotSupportedException (errorMsg
);
651 [MonoLimitation(errorMsg
)]
652 public Task
<TResult
> FromAsync
<TArg1
, TArg2
, TArg3
> (Func
<TArg1
, TArg2
, TArg3
, AsyncCallback
, Object
, IAsyncResult
> beginMethod
,
653 Func
<IAsyncResult
, TResult
> endMethod
,
654 TArg1 arg1
, TArg2 arg2
, TArg3 arg3
, object state
,
655 TaskCreationOptions creationOptions
)
657 throw new NotSupportedException (errorMsg
);
661 public TaskScheduler Scheduler
{
667 public TaskContinuationOptions ContinuationOptions
{
673 public TaskCreationOptions CreationOptions
{