Closed Jauler closed 3 years ago
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 -- https://github.com/tgockel/zookeeper-cpp/pull/117 .
Thanks for your work and patience!
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()
withboost::current_exception()
requires that exception would be either thrown withboost::throw_exception()
or wrapped inboost::enable_current_exception(...)
(I tested on gcc 7 and without wrapping, exception rethrown was of wrong type). To work around this I addedzk::throw_exception()
wrapper which either throws directly forstd::future
case or does necessary wrapping when usingboost::future
.Another problem was that
boost::enable_current_exception()
, requires derived exception types. Therefore I removedfinal
declarations from error types.Also I introduced
zk::exception_ptr
,zk::current_exception()
andzk::async()
to map either tostd
variants orboost
ones for compatability.This most likely solves #108 and #107