Coder Social home page Coder Social logo

loveyacper / ananas Goto Github PK

View Code? Open in Web Editor NEW
536.0 45.0 128.0 1.33 MB

A C++11 RPC framework based on future and protobuf, with utility: timer,ssl,future/promise,log,coroutine,etc

License: MIT License

CMake 2.35% Makefile 0.05% C++ 97.61%
c-plus-plus rpc coroutine future server-side

ananas's Issues

t'r'y

exception_.~exception_ptr()

参见对正在编译的函数 模板 实例化

note: 参见对正在编译的函数 模板 实例化“ananas::Future ananas::Future::_ThenImpl<F,R,T&&>(ananas::Scheduler *,F &&,ananas::internal::ResultOfWrapper<F,T &&>)”的引用
1> with
1> [
1> F=main::<lambda_0ca2531bee9689aededc86c496028799>,
1> R=ananas::internal::CallableResult<main::<lambda_0ca2531bee9689aededc86c496028799>,int>,
1> T=int
1> ]

我用msvc编译提示这个,但是能编译过去的,警告降到2级就不会提示···有问题吗这个!

烦请处理下gcc的警告

这种capture的方式在C++11标准下会报警告,麻烦看下是否可以修复。

dep/ananas/future/Future.h:489:26: warning: lambda capture initializers only available with -std=c++14 or -std=gnu++14
                          prom = std::move(pm)](typename TryWrapper<T>::Type&& t) mutable {

dep/ananas/future/Future.h:491:28: warning: lambda capture initializers only available with -std=c++14 or -std=gnu++14
                 auto cb = [func = std::move(func), t = std::move(t), prom = std::move(prom)]() mutable {

future/promise集成度似乎还不够高

网络的一些操作还是基于epoll的异步回调的,比如connector中的非阻塞连接行为, 能否具有类似
connect().then([] { onSuccess(); }) 的同步调用模式呢?
另外,同步阻塞操作的异步化都是通过线程池的方式实现的,这里能不能考虑使用协程而不是线程来避免线程上下文切换的开销呢?

Future.h内有个小问题

static_assert(std::is_same<T, void>::value ||
std::is_copy_constructible() ||
std::is_move_constructible(),
"must be copyable or movable or void");
修改为
static_assert(std::is_same<T, void>::value ||
std::is_copy_constructible::value ||
std::is_move_constructible::value,
"must be copyable or movable or void");

可以中断then的future 链吗

ananas::MakeReadyFuture()
	.Then([] {
		throw std::runtime_error("rrrrrrrrrrrrrrrrrrr");
		return std::string{"Hello1"};
	})
	.Then([](ananas::Try<std::string>&& str) {
		try {
			std::string a = str;
			std::cout << a << std::endl;
			return 100;
		} catch (const std::runtime_error&) {
			std::cout << "xxxxxx" << std::endl;
                           // 希望发生异常以后 退出 这个回调链
			return 888;
		}
	})
	.Then([](int nn) {
		std::cout << nn << std::endl;
	});

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.