Adds a way to cancel a blocking rpc call (#94)

This commit is contained in:
Thad House
2016-08-16 23:31:45 -07:00
committed by Peter Johnson
parent d6e8de21ef
commit c0ce4270f0
8 changed files with 20 additions and 0 deletions

View File

@@ -1446,3 +1446,10 @@ bool Storage::GetRpcResult(bool blocking, unsigned int call_uid, double time_out
return true;
}
}
void Storage::CancelBlockingRpcResult(unsigned int call_uid) {
std::unique_lock<std::mutex> lock(m_mutex);
// safe to erase even if id does not exist
m_rpc_blocking_calls.erase(call_uid);
m_rpc_results_cond.notify_all();
}