| 74 | } |
| 75 | |
| 76 | void DenseBFSGraph::addSingleParent(uint16_t iter, nodeID_t boundNodeID, relID_t edgeID, |
| 77 | nodeID_t nbrNodeID, bool fwdEdge, ObjectBlock<ParentList>* block) { |
| 78 | auto parent = reserveParent(boundNodeID, edgeID, fwdEdge, block); |
| 79 | parent->setIter(iter); |
| 80 | ParentList* expected = nullptr; |
| 81 | if (curData[nbrNodeID.offset].compare_exchange_strong(expected, parent)) { |
| 82 | parent->setNextPtr(expected); |
| 83 | } else { |
| 84 | // Other thread has added the parent. Do NOT add parent and revert reserved slot. |
| 85 | block->revertLast(); |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | static double getCost(ParentList* parentList) { |
| 90 | return parentList == nullptr ? std::numeric_limits<double>::max() : parentList->getCost(); |
no test coverage detected