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

Allow use of boost::future as zk::future #112

Closed
wants to merge 12 commits into from

Conversation

Jauler
Copy link
Contributor

@Jauler Jauler commented Sep 24, 2019

Hey,

So we would like to use boost::future also therefore I made this implementation. This might not be ideal solution, but it solves my problem.

Most of the 'not ideal solution' comes from the fact, that calling boost::promise::set_exception() with boost::current_exception() requires that exception would be either thrown with boost::throw_exception() or wrapped in boost::enable_current_exception(...) (I tested on gcc 7 and without wrapping, exception rethrown was of wrong type). To work around this I added zk::throw_exception() wrapper which either throws directly for std::future case or does necessary wrapping when using boost::future.

Another problem was that boost::enable_current_exception(), requires derived exception types. Therefore I removed final declarations from error types.

Also I introduced zk::exception_ptr, zk::current_exception() and zk::async() to map either to std variants or boost ones for compatability.

This most likely solves #108 and #107

@tgockel
Copy link
Owner

tgockel commented Sep 21, 2020

Apparently I forgot about this...sorry. This looks really good, but unfortunately, it won't build because CI doesn't work for old Ubuntu versions. I squashed and rebased these changes over to a new PR -- #117 .

Thanks for your work and patience!

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

Successfully merging this pull request may close these issues.

2 participants