]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
worker: rename task_t to worker_task_t to fix redefinition issues with liburcu 0...
authorDaniel Salzman <daniel.salzman@nic.cz>
Sun, 5 Sep 2021 18:07:50 +0000 (20:07 +0200)
committerDaniel Salzman <daniel.salzman@nic.cz>
Tue, 7 Sep 2021 13:38:21 +0000 (15:38 +0200)
src/knot/events/events.c
src/knot/events/events.h
src/knot/worker/pool.c
src/knot/worker/queue.c
src/knot/worker/queue.h
tests/knot/test_worker_pool.c
tests/knot/test_worker_queue.c

index cfafae343b579eec36ed8b13f37c31ecd148cf3c..41c297626e3cc1e706e88683108a35d8b8c94808 100644 (file)
@@ -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);
index e384e54065c5b02a191140c9d6b0f12414279fd6..8376b8b88ebf89208b6ef786650d41eb35f5a062 100644 (file)
@@ -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.
index 3ee69bc2a4e3b54ae21d39172c09393ec084c8d4..ff7497088b24c840c764164bac843d5437110c82 100644 (file)
@@ -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);
                }
index fcc0b28b0d3439c969db4d832c989988b7e9ecf6..d9fc2b63c9ee951dee5fc748c1defc6740342aff 100644 (file)
@@ -1,4 +1,4 @@
-/*  Copyright (C) 2019 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
+/*  Copyright (C) 2021 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
 
     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);
index 42ecde6292a82923aef45cb0ccbdf54f9db38aeb..0ade7ab1b3359cf51a5f411490bb5409a1929771 100644 (file)
@@ -1,4 +1,4 @@
-/*  Copyright (C) 2019 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
+/*  Copyright (C) 2021 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
 
     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.
index 5cb3b9346e2921d76954883834a39545eb16d9b4..59dee36f172aacd62e2bbfe6022be33416b2cd2e 100644 (file)
@@ -1,4 +1,4 @@
-/*  Copyright (C) 2014 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
+/*  Copyright (C) 2021 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
 
     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);
        }
index 3fa5ff10ab82c555beee722fa89351e9520782a6..2d20afdc255642e3305eb810e7e9066e99df0b89 100644 (file)
@@ -1,4 +1,4 @@
-/*  Copyright (C) 2014 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
+/*  Copyright (C) 2021 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
 
     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