]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: task/thread: fix single-threaded build of task.c
authorWilly Tarreau <w@1wt.eu>
Mon, 15 Apr 2019 16:52:40 +0000 (18:52 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 15 Apr 2019 16:52:40 +0000 (18:52 +0200)
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.

src/task.c

index 4e6a151e7b121a2ebb4c6ea89c34b61e641255c5..33c50c4175d5e9d0fadfd7f211dbb070f51a4320 100644 (file)
@@ -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);