Data-TimingWheel-Shared

 view release on metacpan or  search on metacpan

Shared.xs  view on Meta::CPAN

    tw_rwlock_wrunlock(h);
  OUTPUT:
    RETVAL

void
advance(self, ticks = 1)
    SV *self
    IV ticks
  PREINIT:
    EXTRACT(self);
  PPCODE:
    {
        REEXTRACT(self);   /* `ticks = 1` is converted after PREINIT, so its magic already ran */
        uint64_t *out = NULL, fired = 0, i, cap = h->capacity;
        /* signed: reject a negative tick count (would UV-wrap to ~2^64 and spin the
         * per-tick loop under the write lock, wedging every sharer) */
        if (ticks < 0) croak("Data::TimingWheel::Shared->advance: ticks must be >= 0");
        if (cap) { Newx(out, (size_t)cap, uint64_t); SAVEFREEPV(out); }   /* alloc BEFORE the lock */
        tw_rwlock_wrlock(h);
        fired = cap ? tw_advance_locked(h, (uint64_t)ticks, out, cap) : 0;
        __atomic_fetch_add(&h->hdr->stat_ops, 1, __ATOMIC_RELAXED);



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