summaryrefslogtreecommitdiffstats
path: root/include/libtf/heap.h
diff options
context:
space:
mode:
authorTimo Teras <timo.teras@iki.fi>2009-11-26 09:35:49 +0200
committerTimo Teras <timo.teras@iki.fi>2009-11-26 09:37:24 +0200
commitaa530f352b0410150bfe94c821ae32c1378b9d02 (patch)
treefb27f277db0c7feaaf12ce43169d3b0b44e95c0f /include/libtf/heap.h
parent4db830052d941d9c6de281bc9a2f6ac212c59ad8 (diff)
downloadlibtf-aa530f352b0410150bfe94c821ae32c1378b9d02.tar.bz2
libtf-aa530f352b0410150bfe94c821ae32c1378b9d02.tar.xz
libtf: stackable timeouts
instead of having per-function argument, use a push/pop mechanism: - multiple timers inside fiber use only one heap entry - easy to chain multiple possibly blocking operations inside one timeout block
Diffstat (limited to 'include/libtf/heap.h')
-rw-r--r--include/libtf/heap.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/libtf/heap.h b/include/libtf/heap.h
index 24f4767..a68e01d 100644
--- a/include/libtf/heap.h
+++ b/include/libtf/heap.h
@@ -61,6 +61,12 @@ int tf_heap_empty(struct tf_heap_head *head)
}
static inline
+int tf_heap_node_active(struct tf_heap_node *node)
+{
+ return node->index != 0;
+}
+
+static inline
int tf_heap_prealloc(struct tf_heap_head *head, uint32_t size)
{
if (unlikely(head->num_items + TF_HEAP_ITEM0 >= head->allocated))