Skip to content

Commit

Permalink
move new function to the end of corobase.cc
Browse files Browse the repository at this point in the history
  • Loading branch information
YongjunHe committed Dec 19, 2020
1 parent c403e0f commit 4c5bd4f
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions corobase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -172,25 +172,6 @@ void ConcurrentMasstreeIndex::simple_coro_MultiGet(
MM::epoch_exit(0, e);
}

void ConcurrentMasstreeIndex::simple_coro_MultiOps(std::vector<rc_t> &rcs,
std::vector<std::experimental::coroutine_handle<ermia::coro::generator<rc_t>::promise_type>> &handles) {
int finished = 0;
while (finished < handles.size()) {
for (int i = 0; i < handles.size(); ++i) {
if (handles[i]) {
if (handles[i].done()) {
++finished;
rcs[i] = handles[i].promise().get_return_value();
handles[i].destroy();
handles[i] = nullptr;
} else {
handles[i].resume();
}
}
}
}
}

ermia::coro::generator<rc_t> ConcurrentMasstreeIndex::coro_GetRecordSV(transaction *t, const varstr &key,
varstr &value, OID *out_oid) {
OID oid = INVALID_OID;
Expand Down Expand Up @@ -1628,5 +1609,24 @@ ermia::coro::generator<rc_t> ConcurrentMasstreeIndex::coro_Scan(transaction *t,
done:
co_return c.return_code;
}

void ConcurrentMasstreeIndex::simple_coro_MultiOps(std::vector<rc_t> &rcs,
std::vector<std::experimental::coroutine_handle<ermia::coro::generator<rc_t>::promise_type>> &handles) {
int finished = 0;
while (finished < handles.size()) {
for (int i = 0; i < handles.size(); ++i) {
if (handles[i]) {
if (handles[i].done()) {
++finished;
rcs[i] = handles[i].promise().get_return_value();
handles[i].destroy();
handles[i] = nullptr;
} else {
handles[i].resume();
}
}
}
}
}
#endif
} // namespace ermia

0 comments on commit 4c5bd4f

Please # to comment.