Data-Graph-Shared

 view release on metacpan or  search on metacpan

Shared.xs  view on Meta::CPAN

    h->node_data[(uint32_t)node] = (int64_t)data;
    __atomic_fetch_add(&h->hdr->stat_ops, 1, __ATOMIC_RELAXED);
    graph_mutex_unlock(h->hdr);

void
neighbors(self, node)
    SV *self
    UV node
  PREINIT:
    EXTRACT_GRAPH(self);
  PPCODE:
    /* Collect edges under lock, then build Perl SVs outside it:
     * newAV/newSVuv/newSViv can longjmp on OOM, which would leak the
     * process-shared mutex to peers (no automatic cleanup for futex). */
    graph_mutex_lock(h->hdr);
    REQUIRE_NODE(h, node);
    uint32_t deg = graph_degree(h, (uint32_t)node);
    uint32_t eidx = h->node_heads[(uint32_t)node];
    uint32_t *dsts = deg ? (uint32_t *)malloc(deg * sizeof(uint32_t)) : NULL;
    int64_t  *wts  = deg ? (int64_t *)malloc(deg * sizeof(int64_t))  : NULL;
    if (deg && (!dsts || !wts)) {



( run in 2.305 seconds using v1.01-cache-2.11-cpan-71847e10f99 )