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

XMLWordPrintableJSON

    • 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
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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 (Inactive)
              Reporter:
              George Wangensteen (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: