in rpc/out-of-order-execution.h [146:193]
inline void ooo_execution_example()
{
class Example
{
public:
Example()
{
m_engine = new_ooo_execution_engine();
}
uint64_t OOO_Operation()
{
OutOfOrderContext args;
init_ooo_args(&args);
ooo_issue_wait(args);
uint64_t ret = this->collect_result();
ooo_result_collected(args);
return ret;
}
~Example()
{
delete_ooo_execution_engine(m_engine);
}
private:
OutOfOrder_Execution_Engine* m_engine;
void init_ooo_args(OutOfOrderContext* args)
{
args->engine = m_engine;
args->do_issue.bind(this, &Example::issue);
args->do_completion.bind(this, &Example::complete);
}
int issue(OutOfOrderContext* args)
{ // issue the async operation with a tag of `args->tag`
return 0;
}
int complete(OutOfOrderContext* args)
{ // wait for a result of any issued async operation,
// and store its tag to `args->tag`.
return 0;
}
uint64_t collect_result()
{ // collect and return the result
return UINT64_MAX;
}
};
Example().OOO_Operation();
}