Replies: 4 comments
-
Actually, I see you have added an "any_executor" to the develop branch. I still would like to see a solution for (2) above though! |
Beta Was this translation helpful? Give feedback.
-
Hi. Yes. I want to implement many changes in this library, but I haven't had much time (like zero time over the last year). The original idea was to implement a layer based on futures and promises that would put the futures/promises interfaces, sender/receivers, asio, and coroutines in harmony with little effort because you could only implement a valid executor and access all these APIs. I have been refactoring the library locally to achieve these goals and ensure it's tsan-safe, but I never got to complete it. It's hard to get continuations right in a way that's tsan-safe, and all libraries I tested failed with tsan. Even boost.
Yes. I don't know how hard this would be. The usual problem with an eager future is the address for the result needs to be stable once the task starts. |
Beta Was this translation helpful? Give feedback.
-
Thanks for responding! |
Beta Was this translation helpful? Give feedback.
-
Yes. I even used it in some other projects. Having futures attached to a thread pool instead of launching a new thread for each future is already useful enough for many things.
Usually, some edge cases that trigger tsan in continuations. I've experimented with other libraries, but they all had the same issues with tsan. Most don't even test their libraries with tsan because they're too old. After
Not really. It's mostly about expanding the API or fixing these tsan issues. The only foreseeable breaking change would be C++20 at some point because the meta-programming and polyfills are becoming unmanageable. |
Beta Was this translation helpful? Give feedback.
-
I really like the design of this library - though I'm looking for two features that I haven't been able to figure out how to achieve with this library.
I want to be able to define my interfaces with specific types, i.e. returning a future of a specific type... i.e..
shared_future<value_t>
. But it appears the library will not allow me to do this. Instead, it requires me to specify the executor as well?Is it possible to avoid exposing the executor details in the return types specified on my interfaces? (The implementation details behind the interface may well use a number of different executors).
I want to be able explicitly bind the result of one future, to the result of an encapsulating task.
I know there was a specific design decision made to avoid doing this implicitly like other implementations - and I like that, but I would also like to be able to explicitly take that path when it makes sense.
I had toyed with doing this by adding a
tag
option to the executor (indicating to bind the results together)I had also toyed with returning a specific type, i.e.
return bind_result(nested_future)
to indicate I want the result of that task to be the result of this one.Would you consider adding this? or perhaps you have an alternate solution?
Currently, I've wrapped the async method with yet another promise that is fulfilled with a then after the inner task completes, that uses the inline executor to complete the wrapping promise. But it seems wasteful to wrap it in this way. (And this use case also draws your attention to the face that while the inner task might use the default executor, the final returned future is using the inline executor, which brings me back to point 1 - I would like to hide that detail from the interface's type definitions.
All the best, and thanks for your time!
Beta Was this translation helpful? Give feedback.
All reactions