Data-Reservoir-Shared

 view release on metacpan or  search on metacpan

Shared.xs  view on Meta::CPAN

    rsv_rwlock_rdunlock(h);
    RETVAL = ok ? newSVpvn((char *)tmp, (STRLEN)len) : &PL_sv_undef;
  OUTPUT:
    RETVAL

void
sample(self)
    SV *self
  PREINIT:
    EXTRACT(self);
  PPCODE:
    {
        uint64_t k = h->k, isz = h->stride, cnt, i;   /* cached geometry: alloc + copy agree */
        uint8_t *buf;
        /* worst-case snapshot buffer (k slots) allocated BEFORE the lock */
        Newx(buf, (size_t)(k * isz), uint8_t); SAVEFREEPV(buf);
        rsv_rwlock_rdlock(h);
        cnt = rsv_count_locked(h);
        {
            uint64_t smax = rsv_slots_max(h);
            if (cnt > smax) cnt = smax;



( run in 1.480 second using v1.01-cache-2.11-cpan-92ad3014f07 )