MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / foreach

Method foreach

src/core/impl/comp_node/cpu/comp_node.cpp:936–951  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

934Spinlock CpuCompNode::sm_pool_mtx;
935
936void CpuCompNode::foreach (thin_function<void(CompNode)> callback) {
937 if (!sm_pool)
938 return;
939
940 for (size_t i = 0;; ++i) {
941 CompNode cur;
942 {
943 MGB_LOCK_GUARD(sm_pool->mtx);
944 if (i >= sm_pool->nr_used_impl_storage)
945 return;
946 cur = make_comp_node_from_impl(
947 reinterpret_cast<CompNodeRecorderImpl*>(&sm_pool->impl_storage[i]));
948 }
949 callback(cur);
950 }
951}
952
953void CpuCompNode::finalize() {
954 if (sm_pool) {

Callers

nothing calls this directly

Calls 1

callbackFunction · 0.50

Tested by

no test coverage detected