-
Notifications
You must be signed in to change notification settings - Fork 379
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
Add rpc::future for callback support to client async calls #45
Comments
Would you consider having |
The folly library from facebook implements them, but I guess this dependency is way too big.
|
And sorry, it seems I never replied to this: yes, I'd consider it, absolutely. |
So my thinking is: providing std::future<RPCLIB_MSGPACK::object_handl> async_call(invocation i, callback c); And used like: client.async_call({"hello, 2, 3}, [](something) { ... }); Obviously, BTW I'm doing some breaking changes for 3.0, so pretty much anything goes for now in terms of interface breakage. |
Excellent. I really look forward for this feature. For now I'm using this hack in Qt : connect(ui->actionCalibrate,&QAction::triggered,this,[=](){
auto f = client->async_call("calibrate");
QFuture<void> future = QtConcurrent::run([this,&f](){
bool done = f.get().as<bool>();
});
}); |
What do you think about the proposed overload? |
That would work, but I think that would be clearer to have : auto f = client->async_call("add",2,3);
auto f = client->async_call("add",2,3).then( [](){} ); Rather than : auto f = client->async_call("add",2,3);
auto f = client->async_call( {"add",2,3} , [](){} ); // is that you'd construct the invoker ? |
Yeah, that's pretty much my proposal. I agree that |
I think you can take from https://github.com/jaredhoberock/future, it seems promising 👍 |
If I understand correctly, that is a third option: But I also found that |
No description provided.
The text was updated successfully, but these errors were encountered: