Skip to content

Commit

Permalink
conv-conds: Eliminate std::vector<ccd_periodic_callback> expired
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-charmworks committed Jun 21, 2023
1 parent 8c87890 commit 1514bdc
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/conv-core/conv-conds.C
Original file line number Diff line number Diff line change
Expand Up @@ -250,27 +250,18 @@ static void ccd_heap_update(double curWallTime)
{
auto & h = CpvAccess(ccd_heap);

std::vector<ccd_periodic_callback> expired;

/* Pull out all expired heap entries */
// Execute all expired heap entries
while (!h.empty())
{
const ccd_heap_elem & e = h.top();

if (e.time >= curWallTime)
break;

expired.emplace_back(std::move(e.cb));
const ccd_periodic_callback cb = std::move(e.cb);

h.pop();
}

/* Now execute those heap entries. This must be
separated from the removal phase because executing
an entry may change the heap.
*/
for (const ccd_periodic_callback & cb : expired)
{
int old = CmiSwitchToPE(cb.pe);
(*(cb.fn))(cb.arg, curWallTime);
int unused = CmiSwitchToPE(old);
Expand Down

0 comments on commit 1514bdc

Please sign in to comment.