Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with executor_t and when_all() #192

Closed
aaronalbers opened this issue Oct 23, 2018 · 5 comments
Closed

Issues with executor_t and when_all() #192

aaronalbers opened this issue Oct 23, 2018 · 5 comments

Comments

@aaronalbers
Copy link
Contributor

aaronalbers commented Oct 23, 2018

I can't quite track this issue down but I think it has something to do with how we are forwarding and moving the supplied executor (I could be way off though).

#include <iostream>
#include <string>

#include <stlab/concurrency/default_executor.hpp>
#include <stlab/concurrency/future.hpp>
#include <stlab/concurrency/utility.hpp>


static stlab::executor_t make_executor(std::string n) {
   return [n](stlab::task<void()> f) mutable {
      std::cout << n << std::endl;
      stlab::default_executor(std::move(f));
   };
}

int main() {
   auto f = stlab::when_all(make_executor("executor"), [](auto x, auto y) { return x + y; }, 
        stlab::make_ready_future<int>(42, stlab::immediate_executor),
        stlab::make_ready_future<int>(42, stlab::immediate_executor));
   std::cout << "done:" << stlab::blocking_get(f) << std::endl;
   return 0;
}

Compiled with stlab folder in same directory as main.cpp:
clang++ main.cpp -std=c++14 -fcoroutines-ts -I.

Output:

executor
libc++abi.dylib: terminating with uncaught exception of type std::__1::bad_function_call: std::exception
Abort trap: 6

Expected:

executor
executor
done:84
@FelixPetriconi
Copy link
Member

You are right the mistake is in future.hpp:1168, where the executor is moved into attach_when_args. I will fix this before the end of the week. Thanks for spotting!

@aaronalbers
Copy link
Contributor Author

This still appears to be an issue in 1.3.3

@FelixPetriconi
Copy link
Member

That's correct. I am still working on the fix. But other users needed urgently other fixes.
(The content of a release is described in the https://github.com/stlab/libraries/blob/develop/CHANGES.md)

@FelixPetriconi
Copy link
Member

I am sure that I have a solution here. But currently, the Travis job with the clang thread sanitizer check fails while it passes locally for me with the same environment.

@FelixPetriconi
Copy link
Member

Done in 1.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants