Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

7
  • Note that an ordinary method/function call, in the absence of a promise/future and .wait(), is also considered a "blocking call." Commented Jun 17, 2021 at 21:46
  • So your .wait() call could merely be considered an ordinary method call, in this context. What is it waiting for? The result of the promise/future to arrive. Commented Jun 17, 2021 at 21:47
  • What, exactly, is the mechanism under the hood that accomplishes this, I'm not sure. It could be as simple as a callback. In any case, the source code for std::future is here, if you're so inclined. Commented Jun 17, 2021 at 21:53
  • Fair point - I am trying to understand the distinction (that exists in my mind, at least) between blocking calls that are doing things (e.g., adding numbers) vs. blocking calls that are not doing any work of their own but are instead waiting for work to finish elsewhere. Commented Jun 17, 2021 at 21:56
  • Note the #include <mutex> at line 38, which is the first mechanism I thought of that might accomplish this. Commented Jun 17, 2021 at 21:57