[SERVER-62560] Add a ::valid() member to Future-y types to see if they refer to shared state Created: 12/Jan/22 Updated: 20/Sep/23 Resolved: 25/May/22 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | George Wangensteen | Assignee: | Matt Diener (Inactive) |
| Resolution: | Done | Votes: | 1 |
| Labels: | servicearch-q1-2022, servicearch-wfbf-day | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Sprint: | Service Arch 2022-03-07, Service Arch 2022-03-21, Service Arch 2022-04-04, Service Arch 2022-04-18, Service Arch 2022-05-02, Service Arch 2022-05-16, Service Arch 2022-05-30 |
| Participants: |
| Description |
|
std::future has a "bool Future<T>::valid()" member function that returns true if the future refers to shared state. This is useful in determining if the Future has been moved-from, which can be helpful when a future needs to be "exchanged" or "handed-out" via an API. For an example, see PackagedTask, which needs to "hand out" a Future and then later should be able to check if the Future has already been moved-from, rather than tracking this information separately.
We should be able to do this by checking the of the Future::FutureImpl's SharedStateHolder member, but may require some more digging. |
| Comments |
| Comment by Githook User [ 20/Sep/23 ] |
|
Author: {'name': 'Matt Diener', 'email': 'matt.diener@mongodb.com', 'username': 'mattdiener'}Message: |
| Comment by Githook User [ 12/May/22 ] |
|
Author: {'name': 'Matt Diener', 'email': 'matt.diener@mongodb.com', 'username': 'mattdiener'}Message: |
| Comment by George Wangensteen [ 12/Jan/22 ] |
|
|