[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: SERVER-62560 implement valid() on Future types
Branch: v6.0
https://github.com/mongodb/mongo/commit/f461cad1b57e30f6ac16a197c63f70198726e5c0

Comment by Githook User [ 12/May/22 ]

Author:

{'name': 'Matt Diener', 'email': 'matt.diener@mongodb.com', 'username': 'mattdiener'}

Message: SERVER-62560 implement valid() on Future types
Branch: master
https://github.com/mongodb/mongo/commit/77438f28038ef1002f04f5df7943df84792fd81e

Comment by George Wangensteen [ 12/Jan/22 ]

cc billy.donahue

 

Generated at Thu Feb 08 05:55:28 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.