Creates a cancelled task with the given error.
()
| 184 | * Creates a cancelled task with the given error. |
| 185 | */ |
| 186 | public static <TResult> Task<TResult> cancelled() { |
| 187 | Task<TResult>.TaskCompletionSource tcs = Task.<TResult> create(); |
| 188 | tcs.setCancelled(); |
| 189 | return tcs.getTask(); |
| 190 | } |
| 191 | |
| 192 | /** |
| 193 | * Makes a fluent cast of a Task's result possible, avoiding an extra continuation just to cast |