Data-MinHash-Shared
view release on metacpan or search on metacpan
mnh_rwlock_wrlock(h);
mnh_merge_locked(h, tmp, k);
__atomic_fetch_add(&h->hdr->stat_ops, 1, __ATOMIC_RELAXED);
mnh_rwlock_wrunlock(h);
void
registers(self)
SV *self
PREINIT:
EXTRACT(self);
PPCODE:
{
uint64_t k = h->hdr->k;
uint64_t kmax = mnh_reg_max(h); /* Layer B: never read past the real mapping */
if (k > kmax) k = kmax;
uint64_t *snap = NULL;
if (k) { Newx(snap, (size_t)k, uint64_t); SAVEFREEPV(snap); } /* alloc BEFORE the lock */
mnh_rwlock_rdlock(h);
if (k) memcpy(snap, mnh_registers(h), (size_t)k * sizeof(uint64_t));
mnh_rwlock_rdunlock(h);
EXTEND(SP, (SSize_t)k);
( run in 0.720 second using v1.01-cache-2.11-cpan-92ad3014f07 )