MCPcopy Create free account
hub / github.com/alibaba/PhotonLibOS / down

Method down

thread/thread.cpp:456–475  ·  view source on GitHub ↗

compare m_nodes[idx] with child node.

Source from the content-addressed store, hash-verified

454
455 // compare m_nodes[idx] with child node.
456 bool down(int idx)
457 {
458 assert(!q.empty());
459 auto tmp = q[idx];
460 size_t cmpIdx = (idx << 1) + 1;
461 bool ret = false;
462 while (cmpIdx < q.size()) {
463 if (cmpIdx + 1 < q.size() && *q[cmpIdx + 1] < *q[cmpIdx]) cmpIdx++;
464 if (*q[cmpIdx] < *tmp){
465 update_node(idx, q[cmpIdx]);
466 idx = cmpIdx;
467 cmpIdx = (idx << 1) + 1;
468 ret = true;
469 continue;
470 }
471 break;
472 }
473 if (ret) update_node(idx, tmp);
474 return ret;
475 }
476 };
477
478 // A special spinlock that distinguishes a foreground vCPU among

Callers

nothing calls this directly

Calls 2

emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected