From: Willy Tarreau Date: Mon, 15 Apr 2019 16:52:40 +0000 (+0200) Subject: BUILD: task/thread: fix single-threaded build of task.c X-Git-Tag: v2.0-dev3~276 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3466e3cdcbdd637c54cc8d3090007f5c0a23ea03;p=thirdparty%2Fhaproxy.git BUILD: task/thread: fix single-threaded build of task.c As expected, commit cde7902ac ("MEDIUM: tasks: improve fairness between the local and global queues") broke the build with threads disabled, and I forgot to rerun this test before committing. No backport is needed. --- diff --git a/src/task.c b/src/task.c index 4e6a151e7b..33c50c4175 100644 --- a/src/task.c +++ b/src/task.c @@ -332,6 +332,7 @@ void process_runnable_tasks() while (task_per_thread[tid].task_list_size < max_processed) { if ((global_tasks_mask & tid_bit) && !grq) { +#ifdef USE_THREAD HA_SPIN_LOCK(TASK_RQ_LOCK, &rq_lock); grq = eb32sc_lookup_ge(&rqueue, rqueue_ticks - TIMER_LOOK_BACK, tid_bit); if (unlikely(!grq)) { @@ -341,6 +342,7 @@ void process_runnable_tasks() _HA_ATOMIC_AND(&global_tasks_mask, ~tid_bit); } } +#endif } /* If a global task is available for this thread, it's in grq @@ -361,6 +363,7 @@ void process_runnable_tasks() lrq = eb32sc_next(lrq, tid_bit); __task_unlink_rq(t); } +#ifdef USE_THREAD else { t = eb32sc_entry(grq, struct task, rq); grq = eb32sc_next(grq, tid_bit); @@ -373,6 +376,7 @@ void process_runnable_tasks() } } } +#endif /* Make sure nobody re-adds the task in the runqueue */ _HA_ATOMIC_OR(&t->state, TASK_RUNNING);