Skip to content

Commit f9aef8f

Browse files
authored
Merge pull request #2198 from mikeblome/mb-task
fixes #963
2 parents 9bc5124 + 8006b90 commit f9aef8f

1 file changed

Lines changed: 11 additions & 17 deletions

File tree

‎docs/parallel/concrt/reference/task-class.md‎

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,28 @@
11
---
22
title: "task Class (Concurrency Runtime)"
3-
ms.date: "11/04/2016"
3+
ms.date: "07/30/2019"
44
f1_keywords: ["task", "PPLTASKS/concurrency::task", "PPLTASKS/concurrency::task::task", "PPLTASKS/concurrency::task::get", "PPLTASKS/concurrency::task::is_apartment_aware", "PPLTASKS/concurrency::task::is_done", "PPLTASKS/concurrency::task::scheduler", "PPLTASKS/concurrency::task::then", "PPLTASKS/concurrency::task::wait"]
55
helpviewer_keywords: ["task class"]
66
ms.assetid: cdc3a8c0-5cbe-45a0-b5d5-e9f81d94df1a
77
---
88
# task Class (Concurrency Runtime)
99

10-
The Parallel Patterns Library (PPL) `task` class. A `task` object represents work that can be executed asynchronously, and concurrently with other tasks and parallel work produced by parallel algorithms in the Concurrency Runtime. It produces a result of type `_ResultType` on successful completion. Tasks of type `task<void>` produce no result. A task can be waited upon and canceled independently of other tasks. It can also be composed with other tasks using continuations( `then`), and join( `when_all`) and choice( `when_any`) patterns.
10+
The Parallel Patterns Library (PPL) `task` class. A `task` object represents work that can be executed asynchronously and concurrently with other tasks and parallel work produced by parallel algorithms in the Concurrency Runtime. It produces a result of type `_ResultType` on successful completion. Tasks of type `task<void>` produce no result. A task can be waited upon and canceled independently of other tasks. It can also be composed with other tasks using continuations( `then`), and join( `when_all`) and choice( `when_any`) patterns. When a task object is assigned to a new variable, the behavior is that of `std::shared_ptr`; in other words, both objects represent the same underlying task.
1111

1212
## Syntax
1313

1414
```
15-
template <typename T>
16-
class task;
17-
1815
template <>
1916
class task<void>;
2017
21-
template<typename _ReturnType>
18+
template<typename _ResultType>
2219
class task;
2320
```
2421

2522
#### Parameters
2623

27-
*T*<br/>
28-
The task object type.
29-
30-
*_ReturnType*<br/>
31-
The result type of this task.
24+
*_ResultType*<br/>
25+
The type of the result that the task produces.
3226

3327
## Members
3428

@@ -82,7 +76,7 @@ For more information, see [Task Parallelism](../../../parallel/concrt/task-paral
8276
Returns the result this task produced. If the task is not in a terminal state, a call to `get` will wait for the task to finish. This method does not return a value when called on a task with a `result_type` of `void`.
8377

8478
```
85-
_ReturnType get() const;
79+
_ResultType get() const;
8680
8781
void get() const;
8882
```
@@ -131,7 +125,7 @@ The function returns true if the task is completed or canceled (with or without
131125
Determines whether two `task` objects represent different internal tasks.
132126

133127
```
134-
bool operator!= (const task<_ReturnType>& _Rhs) const;
128+
bool operator!= (const task<_ResultType>& _Rhs) const;
135129
136130
bool operator!= (const task<void>& _Rhs) const;
137131
```
@@ -171,7 +165,7 @@ As `task` behaves like a smart pointer, after a copy assignment, this `task` obj
171165
Determines whether two `task` objects represent the same internal task.
172166

173167
```
174-
bool operator== (const task<_ReturnType>& _Rhs) const;
168+
bool operator== (const task<_ResultType>& _Rhs) const;
175169
176170
bool operator== (const task<void>& _Rhs) const;
177171
```
@@ -257,20 +251,20 @@ Adds a continuation task to this task.
257251
template<typename _Function>
258252
__declspec(
259253
noinline) auto then(const _Function& _Func) const -> typename details::_ContinuationTypeTraits<_Function,
260-
_ReturnType>::_TaskOfType;
254+
_ResultType>::_TaskOfType;
261255
262256
template<typename _Function>
263257
__declspec(
264258
noinline) auto then(const _Function& _Func,
265259
const task_options& _TaskOptions) const -> typename details::_ContinuationTypeTraits<_Function,
266-
_ReturnType>::_TaskOfType;
260+
_ResultType>::_TaskOfType;
267261
268262
template<typename _Function>
269263
__declspec(
270264
noinline) auto then(const _Function& _Func,
271265
cancellation_token _CancellationToken,
272266
task_continuation_context _ContinuationContext) const -> typename details::_ContinuationTypeTraits<_Function,
273-
_ReturnType>::_TaskOfType;
267+
_ResultType>::_TaskOfType;
274268
275269
template<typename _Function>
276270
__declspec(

0 commit comments

Comments
 (0)