Boost logo

Boost :

From: Stjepan Rajko (stipe_at_[hidden])
Date: 2007-05-19 14:20:37


I have packed up and posted the most recent iteration of the remote
procedure call library.

Docs and code available at:

It is also available from the boost sandbox under /rpc

The major improvements are:

* futures are now used to handle return values and "out" parameters.
this allows the rpc library execute all of the calls asynchronously,
with the futures interface allowing the user to decide whether the
call indeed behaves asynchronously (by taking all the returned values
into proper futures) or behaves synchronously (either by storing a
return value into a non-future variable, where the future->variable
cast will block until the future is set, or by sending a non-future
variable as an "in/out" parameter)

* what gets to be marshaled back is completely determined by how the
call is made, rather than having to be specified explicitly:

// embed the function id and parameter for an int (int) call
rpc::call<std::string, int (int)> call_inc__1("inc", 1);
// if the returned handler is ignored, nothing is marshaled back:

// if the returned handler is stored in an acknowledgement, only a
confirmation of completion
// is marshaled back.
ack = client(call_inc__1);

// if the returned handler is stored in a proper handler, the return
value will be marshaled back
rpc::async_returning_handler<int>::ptr handler_int = client(call_inc__1);
boost::future<int> future_int(handler_int->return_promise());
BOOST_CHECK_EQUAL(future_int, 2);

// handler returners are imlplicitly convertible to futures, which
will carry the returned value
boost::future<int> result_inc = client(call_inc__1);
BOOST_CHECK_EQUAL(result_inc, 2);

// handler returners are also convertible to values, which immediately
// get assigned the value of the return value future, making the call
int inced1 = client(call_inc__1);

More examples are in the HTML docs. Any feedback is welcome!



P.S. I contacted the author of the RCF library
( to see if he
wants to join efforts in making a boosty rpc lib, but unfortunatelly
he is too busy...

Boost list run by bdawes at, gregod at, cpdaniel at, john at