[SERVER-35027] Add makePromiseFuturePair() helper to util/future.h Created: 16/May/18  Updated: 28/May/19  Resolved: 28/May/19

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: Mira Carey Assignee: DO NOT USE - Backlog - Platform Team
Resolution: Duplicate Votes: 0
Labels: service_architecture_continuous_delivery
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-35234 makePromiseFuture<T>() to create a bo... Closed
Participants:

 Description   

It would be helpful to have a utility which produced promises and futures in one atomic operation, because actually extracting a future from a promise is a racy operation (for multiple threads extracting the future, and for extracting the future and fulfilling the promise).

It should probably look something like:

auto [promise, future] = makePromiseFuturePair<T>();


Generated at Thu Feb 08 04:38:36 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.