MT#55283 add dedicated g_tree_first wrapper

Change-Id: I4f7a366d37ab2c67d57f4217133725917b2e726b
mr13.3
Richard Fuchs 8 months ago
parent 5460ca1f90
commit 75884b8d58

@ -68,7 +68,7 @@ static void timerthread_run(void *p) {
// find the first element if we haven't determined it yet
struct timerthread_obj *tt_obj = tt->obj;
if (!tt_obj) {
tt_obj = rtpe_g_tree_find_first(tt->tree, NULL, NULL);
tt_obj = rtpe_g_tree_first(tt->tree);
if (!tt_obj)
goto sleep_now;
@ -198,7 +198,7 @@ void timerthread_queue_run(void *ptr) {
mutex_lock(&ttq->lock);
while (g_tree_nnodes(ttq->entries)) {
struct timerthread_queue_entry *ttqe = rtpe_g_tree_find_first(ttq->entries, NULL, NULL);
struct timerthread_queue_entry *ttqe = rtpe_g_tree_first(ttq->entries);
assert(ttqe != NULL);
g_tree_remove(ttq->entries, ttqe);
@ -324,7 +324,7 @@ void timerthread_queue_push(struct timerthread_queue *ttq, struct timerthread_qu
// this hands over ownership of cp, so we must copy the timeval out
struct timeval tv_send = ttqe->when;
g_tree_insert(ttq->entries, ttqe, ttqe);
struct timerthread_queue_entry *first_ttqe = rtpe_g_tree_find_first(ttq->entries, NULL, NULL);
struct timerthread_queue_entry *first_ttqe = rtpe_g_tree_first(ttq->entries);
mutex_unlock(&ttq->lock);
// first packet in? we're probably not scheduled yet
@ -366,7 +366,7 @@ void timerthread_queue_flush_data(void *ptr) {
mutex_lock(&ttq->lock);
while (g_tree_nnodes(ttq->entries)) {
struct timerthread_queue_entry *ttqe = rtpe_g_tree_find_first(ttq->entries, NULL, NULL);
struct timerthread_queue_entry *ttqe = rtpe_g_tree_first(ttq->entries);
assert(ttqe != NULL);
g_tree_remove(ttq->entries, ttqe);

@ -431,6 +431,9 @@ INLINE void *rtpe_g_tree_find_first(GTree *t, GEqualFunc f, void *data) {
g_tree_foreach(t, rtpe_tree_find_first_cmp, &h);
return h.out_p;
}
INLINE void *rtpe_g_tree_first(GTree *t) {
return rtpe_g_tree_find_first(t, NULL, NULL);
}
INLINE void rtpe_g_tree_find_all(GQueue *out, GTree *t, GEqualFunc f, void *data) {
struct rtpe_g_tree_find_helper h = {
.func = f,

@ -202,7 +202,7 @@ static void *notify_timer(void *p) {
// grab first entry in list, check retry time, sleep if it's in the future
struct notif_req *first = rtpe_g_tree_find_first(notify_timers, NULL, NULL);
struct notif_req *first = rtpe_g_tree_first(notify_timers);
if (!first) {
ilog(LOG_DEBUG, "No scheduled HTTP notification retries, sleeping");
pthread_cond_wait(&timer_cond, &timer_lock);

Loading…
Cancel
Save