Skip to content

Commit

Permalink
sync
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Oberstein committed Mar 28, 2014
1 parent bafd776 commit 1c47cdb
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/test14.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,15 @@ struct rpcsvc {
timer->async_wait(
[=](system::error_code ec) {
if (!ec) {

// Question 1:
//
// m_call_id seems to be captured by value, though we
// said [=] in the lambda .. why? We workaround by
// using a local var in the enclosing method body.
//
cout << m_call_id << " - " << call_id << endl;

this->m_calls[call_id].m_promise.set_value(x * x);
this->m_calls.erase(call_id);
} else {
Expand Down Expand Up @@ -97,7 +105,15 @@ int main () {

io.run();

// Question 2:
//
// Neither f3 nor f4 "induce" any work on ASIO reactor ..
// so ASIO will end it's loop though the continuation
// hasn't been executed yet. we workaround by "manually"
// waiting .. but that seems suboptimal ..
//
f4.get();

}
catch (std::exception& e) {
cerr << e.what() << endl;
Expand Down

0 comments on commit 1c47cdb

Please sign in to comment.