Skip to content
Snippets Groups Projects
Commit a70b7180 authored by Daniel Salzman's avatar Daniel Salzman
Browse files

worker: rename task_t to worker_task_t to fix redefinition issues with liburcu 0.13.0 on ARM/macOS

parent b679f88b
No related branches found
No related tags found
No related merge requests found
Pipeline #87821 passed
......@@ -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);
......
......@@ -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.
......
......@@ -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);
}
......
/* 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);
......
/* 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.
......
/* 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);
}
......
/* 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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment