Data-IntervalTree-Shared
view release on metacpan or search on metacpan
it_rwlock_wrlock(h);
if (h->hdr->dirty) it_build_locked(h);
it_rwlock_wrunlock(h);
void
stab(self, point)
SV *self
IV point
PREINIT:
EXTRACT(self);
PPCODE:
{
ItRes *res = NULL;
uint64_t got = 0, cap = h->capacity;
if (cap) { Newx(res, (size_t)cap, ItRes); SAVEFREEPV(res); } /* alloc BEFORE the lock */
{
int wr = it_query_lock(h);
got = cap ? it_overlaps_locked(h, (int64_t)point, (int64_t)point, res, cap) : 0;
it_query_unlock(h, wr);
}
PUSH_RESULTS(res, got);
}
void
overlaps(self, lo, hi)
SV *self
IV lo
IV hi
PREINIT:
EXTRACT(self);
PPCODE:
{
ItRes *res = NULL;
uint64_t got = 0, cap = h->capacity;
if (lo > hi) croak("Data::IntervalTree::Shared->overlaps: lo (%" IVdf ") > hi (%" IVdf ")", (IV)lo, (IV)hi);
if (cap) { Newx(res, (size_t)cap, ItRes); SAVEFREEPV(res); } /* alloc BEFORE the lock */
{
int wr = it_query_lock(h);
got = cap ? it_overlaps_locked(h, (int64_t)lo, (int64_t)hi, res, cap) : 0;
it_query_unlock(h, wr);
}
( run in 0.755 second using v1.01-cache-2.11-cpan-92ad3014f07 )