Data-Heap-Shared
view release on metacpan or search on metacpan
CODE:
RETVAL = heap_push(h, (int64_t)priority, (int64_t)value);
OUTPUT:
RETVAL
void
pop(self)
SV *self
PREINIT:
EXTRACT_HEAP(self);
PPCODE:
int64_t p, v;
if (heap_pop(h, &p, &v)) {
EXTEND(SP, 2);
PUSHs(sv_2mortal(newSViv((IV)p)));
PUSHs(sv_2mortal(newSViv((IV)v)));
}
void
pop_wait(self, ...)
SV *self
PREINIT:
EXTRACT_HEAP(self);
double timeout = -1;
PPCODE:
if (items > 1 && (SvGETMAGIC(ST(1)), SvOK(ST(1)))) timeout = SvNV(ST(1));
REEXTRACT_HEAP(self); /* the timeout's get-magic may have destroyed self */
int64_t p, v;
if (heap_pop_wait(h, &p, &v, timeout)) {
EXTEND(SP, 2);
PUSHs(sv_2mortal(newSViv((IV)p)));
PUSHs(sv_2mortal(newSViv((IV)v)));
}
void
peek(self)
SV *self
PREINIT:
EXTRACT_HEAP(self);
PPCODE:
int64_t p, v;
if (heap_peek(h, &p, &v)) {
EXTEND(SP, 2);
PUSHs(sv_2mortal(newSViv((IV)p)));
PUSHs(sv_2mortal(newSViv((IV)v)));
}
UV
size(self)
SV *self
( run in 2.719 seconds using v1.01-cache-2.11-cpan-92ad3014f07 )