Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-62560

Add a ::valid() member to Future-y types to see if they refer to shared state

    • 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

      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. 

            Assignee:
            matt.diener@mongodb.com Matt Diener (Inactive)
            Reporter:
            george.wangensteen@mongodb.com George Wangensteen
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: