lsquic_min_heap.h revision 229fce07
1/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */ 2/* 3 * lsquic_min_heap.h -- Min-heap for connections 4 */ 5 6#ifndef LSQUIC_MIN_HEAP_H 7#define LSQUIC_MIN_HEAP_H 1 8 9struct lsquic_conn; 10 11struct min_heap_elem 12{ 13 struct lsquic_conn *mhe_conn; 14 uint64_t mhe_val; 15}; 16 17 18struct min_heap 19{ 20 struct min_heap_elem *mh_elems; 21 unsigned mh_nalloc, 22 mh_nelem; 23}; 24 25 26void 27lsquic_mh_insert (struct min_heap *, struct lsquic_conn *conn, uint64_t val); 28 29struct lsquic_conn * 30lsquic_mh_pop (struct min_heap *); 31 32#define lsquic_mh_count(heap) (+(heap)->mh_nelem) 33 34#define lsquic_mh_nalloc(heap) (+(heap)->mh_nalloc) 35 36#endif 37