From: Daniel Salzman Date: Sun, 5 Sep 2021 18:07:50 +0000 (+0200) Subject: worker: rename task_t to worker_task_t to fix redefinition issues with liburcu 0... X-Git-Tag: v3.1.2~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a7384e52972e766ca8ede2ff443b4aa2f44efbf9;p=thirdparty%2Fknot-dns.git worker: rename task_t to worker_task_t to fix redefinition issues with liburcu 0.13.0 on ARM/macOS --- diff --git a/src/knot/events/events.c b/src/knot/events/events.c index cfafae343b..41c297626e 100644 --- a/src/knot/events/events.c +++ b/src/knot/events/events.c @@ -199,7 +199,7 @@ static void reschedule(zone_events_t *events) * 3. Perform the event's callback. * 4. Schedule next event planned event. */ -static void event_wrap(task_t *task) +static void event_wrap(worker_task_t *task) { assert(task); assert(task->ctx); diff --git a/src/knot/events/events.h b/src/knot/events/events.h index e384e54065..8376b8b88e 100644 --- a/src/knot/events/events.h +++ b/src/knot/events/events.h @@ -61,7 +61,7 @@ typedef struct zone_events { event_t *event; //!< Scheduler event. worker_pool_t *pool; //!< Server worker pool. - task_t task; //!< Event execution context. + worker_task_t task; //!< Event execution context. time_t time[ZONE_EVENT_COUNT]; //!< Event execution times. bool forced[ZONE_EVENT_COUNT]; //!< Flag that the event was invoked by user ctl. pthread_cond_t *blocking[ZONE_EVENT_COUNT]; //!< For blocking events: dispatching cond. diff --git a/src/knot/worker/pool.c b/src/knot/worker/pool.c index 3ee69bc2a4..ff7497088b 100644 --- a/src/knot/worker/pool.c +++ b/src/knot/worker/pool.c @@ -61,7 +61,7 @@ static int worker_main(dthread_t *thread) break; } - task_t *task = NULL; + worker_task_t *task = NULL; if (!pool->suspended) { task = worker_queue_dequeue(&pool->tasks); } diff --git a/src/knot/worker/queue.c b/src/knot/worker/queue.c index fcc0b28b0d..d9fc2b63c9 100644 --- a/src/knot/worker/queue.c +++ b/src/knot/worker/queue.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2019 CZ.NIC, z.s.p.o. +/* Copyright (C) 2021 CZ.NIC, z.s.p.o. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -34,7 +34,7 @@ void worker_queue_deinit(worker_queue_t *queue) ptrlist_free(&queue->list, &queue->mm_ctx); } -void worker_queue_enqueue(worker_queue_t *queue, task_t *task) +void worker_queue_enqueue(worker_queue_t *queue, worker_task_t *task) { if (!queue || !task) { return; @@ -43,13 +43,13 @@ void worker_queue_enqueue(worker_queue_t *queue, task_t *task) ptrlist_add(&queue->list, task, &queue->mm_ctx); } -task_t *worker_queue_dequeue(worker_queue_t *queue) +worker_task_t *worker_queue_dequeue(worker_queue_t *queue) { if (!queue) { return NULL; } - task_t *task = NULL; + worker_task_t *task = NULL; if (!EMPTY_LIST(queue->list)) { ptrnode_t *node = HEAD(queue->list); diff --git a/src/knot/worker/queue.h b/src/knot/worker/queue.h index 42ecde6292..0ade7ab1b3 100644 --- a/src/knot/worker/queue.h +++ b/src/knot/worker/queue.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2019 CZ.NIC, z.s.p.o. +/* Copyright (C) 2021 CZ.NIC, z.s.p.o. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -27,7 +27,7 @@ typedef void (*task_cb)(struct task *); typedef struct task { void *ctx; task_cb run; -} task_t; +} worker_task_t; /*! * \brief Worker queue. @@ -50,14 +50,14 @@ void worker_queue_deinit(worker_queue_t *queue); /*! * \brief Insert new item into the queue. */ -void worker_queue_enqueue(worker_queue_t *queue, task_t *task); +void worker_queue_enqueue(worker_queue_t *queue, worker_task_t *task); /*! * \brief Remove item from the queue. * * \return Task or NULL if the queue is empty. */ -task_t *worker_queue_dequeue(worker_queue_t *queue); +worker_task_t *worker_queue_dequeue(worker_queue_t *queue); /*! * \brief Return number of tasks in worker queue. diff --git a/tests/knot/test_worker_pool.c b/tests/knot/test_worker_pool.c index 5cb3b9346e..59dee36f17 100644 --- a/tests/knot/test_worker_pool.c +++ b/tests/knot/test_worker_pool.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2014 CZ.NIC, z.s.p.o. +/* Copyright (C) 2021 CZ.NIC, z.s.p.o. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -52,7 +52,7 @@ static unsigned executed_reset(task_log_t *log) /*! * Simple task, just increases the counter in the log. */ -static void task_counting(task_t *task) +static void task_counting(worker_task_t *task) { task_log_t *log = task->ctx; @@ -89,7 +89,7 @@ int main(void) // schedule jobs while pool is stopped - task_t task = { .run = task_counting, .ctx = &log }; + worker_task_t task = { .run = task_counting, .ctx = &log }; for (int i = 0; i < TASKS_BATCH; i++) { worker_pool_assign(pool, &task); } diff --git a/tests/knot/test_worker_queue.c b/tests/knot/test_worker_queue.c index 3fa5ff10ab..2d20afdc25 100644 --- a/tests/knot/test_worker_queue.c +++ b/tests/knot/test_worker_queue.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2014 CZ.NIC, z.s.p.o. +/* Copyright (C) 2021 CZ.NIC, z.s.p.o. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,9 +22,9 @@ int main(void) { plan_lazy(); - task_t task_one = { 0 }; - task_t task_two = { 0 }; - task_t task_three = { 0 }; + worker_task_t task_one = { 0 }; + worker_task_t task_two = { 0 }; + worker_task_t task_three = { 0 }; // init