mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
Cleanup the public vs private ISCAPI remnants
Since all the libraries are internal now, just cleanup the ISCAPI remnants in isc_socket, isc_task and isc_timer APIs. This means, there's one less layer as following changes have been done: * struct isc_socket and struct isc_socketmgr have been removed * struct isc__socket and struct isc__socketmgr have been renamed to struct isc_socket and struct isc_socketmgr * struct isc_task and struct isc_taskmgr have been removed * struct isc__task and struct isc__taskmgr have been renamed to struct isc_task and struct isc_taskmgr * struct isc_timer and struct isc_timermgr have been removed * struct isc__timer and struct isc__timermgr have been renamed to struct isc_timer and struct isc_timermgr * All the associated code that dealt with typing isc_<foo> to isc__<foo> and back has been removed.
This commit is contained in:
223
lib/isc/task.c
223
lib/isc/task.c
@@ -97,14 +97,12 @@ static const char *statenames[] = {
|
||||
#define TASK_MAGIC ISC_MAGIC('T', 'A', 'S', 'K')
|
||||
#define VALID_TASK(t) ISC_MAGIC_VALID(t, TASK_MAGIC)
|
||||
|
||||
typedef struct isc__task isc__task_t;
|
||||
typedef struct isc__taskmgr isc__taskmgr_t;
|
||||
typedef struct isc__taskqueue isc__taskqueue_t;
|
||||
|
||||
struct isc__task {
|
||||
struct isc_task {
|
||||
/* Not locked. */
|
||||
isc_task_t common;
|
||||
isc__taskmgr_t *manager;
|
||||
unsigned int magic;
|
||||
isc_taskmgr_t *manager;
|
||||
isc_mutex_t lock;
|
||||
/* Locked by task lock. */
|
||||
task_state_t state;
|
||||
@@ -123,9 +121,9 @@ struct isc__task {
|
||||
/* Protected by atomics */
|
||||
atomic_uint_fast32_t flags;
|
||||
/* Locked by task manager lock. */
|
||||
LINK(isc__task_t) link;
|
||||
LINK(isc__task_t) ready_link;
|
||||
LINK(isc__task_t) ready_priority_link;
|
||||
LINK(isc_task_t) link;
|
||||
LINK(isc_task_t) ready_link;
|
||||
LINK(isc_task_t) ready_priority_link;
|
||||
};
|
||||
|
||||
#define TASK_F_SHUTTINGDOWN 0x01
|
||||
@@ -142,7 +140,7 @@ struct isc__task {
|
||||
#define TASK_MANAGER_MAGIC ISC_MAGIC('T', 'S', 'K', 'M')
|
||||
#define VALID_MANAGER(m) ISC_MAGIC_VALID(m, TASK_MANAGER_MAGIC)
|
||||
|
||||
typedef ISC_LIST(isc__task_t) isc__tasklist_t;
|
||||
typedef ISC_LIST(isc_task_t) isc__tasklist_t;
|
||||
|
||||
struct isc__taskqueue {
|
||||
/* Everything locked by lock */
|
||||
@@ -152,12 +150,12 @@ struct isc__taskqueue {
|
||||
isc_condition_t work_available;
|
||||
isc_thread_t thread;
|
||||
unsigned int threadid;
|
||||
isc__taskmgr_t *manager;
|
||||
isc_taskmgr_t *manager;
|
||||
};
|
||||
|
||||
struct isc__taskmgr {
|
||||
struct isc_taskmgr {
|
||||
/* Not locked. */
|
||||
isc_taskmgr_t common;
|
||||
unsigned int magic;
|
||||
isc_mem_t *mctx;
|
||||
isc_mutex_t lock;
|
||||
isc_mutex_t halt_lock;
|
||||
@@ -172,7 +170,7 @@ struct isc__taskmgr {
|
||||
|
||||
/* Locked by task manager lock. */
|
||||
unsigned int default_quantum;
|
||||
LIST(isc__task_t) tasks;
|
||||
LIST(isc_task_t) tasks;
|
||||
atomic_uint_fast32_t mode;
|
||||
atomic_bool pause_req;
|
||||
atomic_bool exclusive_req;
|
||||
@@ -187,7 +185,7 @@ struct isc__taskmgr {
|
||||
* will try to acquire it.
|
||||
*/
|
||||
isc_mutex_t excl_lock;
|
||||
isc__task_t *excl;
|
||||
isc_task_t *excl;
|
||||
};
|
||||
|
||||
void
|
||||
@@ -207,29 +205,29 @@ isc__taskmgr_resume(isc_taskmgr_t *manager0);
|
||||
*/
|
||||
|
||||
bool
|
||||
isc_task_purgeevent(isc_task_t *task0, isc_event_t *event);
|
||||
isc_task_purgeevent(isc_task_t *task, isc_event_t *event);
|
||||
void
|
||||
isc_taskmgr_setexcltask(isc_taskmgr_t *mgr0, isc_task_t *task0);
|
||||
isc_taskmgr_setexcltask(isc_taskmgr_t *mgr, isc_task_t *task);
|
||||
isc_result_t
|
||||
isc_taskmgr_excltask(isc_taskmgr_t *mgr0, isc_task_t **taskp);
|
||||
isc_taskmgr_excltask(isc_taskmgr_t *mgr, isc_task_t **taskp);
|
||||
static inline bool
|
||||
empty_readyq(isc__taskmgr_t *manager, int c);
|
||||
empty_readyq(isc_taskmgr_t *manager, int c);
|
||||
|
||||
static inline isc__task_t *
|
||||
pop_readyq(isc__taskmgr_t *manager, int c);
|
||||
static inline isc_task_t *
|
||||
pop_readyq(isc_taskmgr_t *manager, int c);
|
||||
|
||||
static inline void
|
||||
push_readyq(isc__taskmgr_t *manager, isc__task_t *task, int c);
|
||||
push_readyq(isc_taskmgr_t *manager, isc_task_t *task, int c);
|
||||
|
||||
static inline void
|
||||
wake_all_queues(isc__taskmgr_t *manager);
|
||||
wake_all_queues(isc_taskmgr_t *manager);
|
||||
|
||||
/***
|
||||
*** Tasks.
|
||||
***/
|
||||
|
||||
static inline void
|
||||
wake_all_queues(isc__taskmgr_t *manager) {
|
||||
wake_all_queues(isc_taskmgr_t *manager) {
|
||||
for (unsigned int i = 0; i < manager->workers; i++) {
|
||||
LOCK(&manager->queues[i].lock);
|
||||
BROADCAST(&manager->queues[i].work_available);
|
||||
@@ -238,8 +236,8 @@ wake_all_queues(isc__taskmgr_t *manager) {
|
||||
}
|
||||
|
||||
static void
|
||||
task_finished(isc__task_t *task) {
|
||||
isc__taskmgr_t *manager = task->manager;
|
||||
task_finished(isc_task_t *task) {
|
||||
isc_taskmgr_t *manager = task->manager;
|
||||
REQUIRE(EMPTY(task->events));
|
||||
REQUIRE(task->nevents == 0);
|
||||
REQUIRE(EMPTY(task->on_shutdown));
|
||||
@@ -263,8 +261,7 @@ task_finished(isc__task_t *task) {
|
||||
wake_all_queues(manager);
|
||||
}
|
||||
isc_mutex_destroy(&task->lock);
|
||||
task->common.impmagic = 0;
|
||||
task->common.magic = 0;
|
||||
task->magic = 0;
|
||||
isc_mem_put(manager->mctx, task, sizeof(*task));
|
||||
}
|
||||
|
||||
@@ -277,8 +274,8 @@ isc_task_create(isc_taskmgr_t *manager0, unsigned int quantum,
|
||||
isc_result_t
|
||||
isc_task_create_bound(isc_taskmgr_t *manager0, unsigned int quantum,
|
||||
isc_task_t **taskp, int threadid) {
|
||||
isc__taskmgr_t *manager = (isc__taskmgr_t *)manager0;
|
||||
isc__task_t *task;
|
||||
isc_taskmgr_t *manager = (isc_taskmgr_t *)manager0;
|
||||
isc_task_t *task;
|
||||
bool exiting;
|
||||
|
||||
REQUIRE(VALID_MANAGER(manager));
|
||||
@@ -339,17 +336,14 @@ isc_task_create_bound(isc_taskmgr_t *manager0, unsigned int quantum,
|
||||
return (ISC_R_SHUTTINGDOWN);
|
||||
}
|
||||
|
||||
task->common.magic = ISCAPI_TASK_MAGIC;
|
||||
task->common.impmagic = TASK_MAGIC;
|
||||
*taskp = (isc_task_t *)task;
|
||||
task->magic = TASK_MAGIC;
|
||||
*taskp = task;
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
void
|
||||
isc_task_attach(isc_task_t *source0, isc_task_t **targetp) {
|
||||
isc__task_t *source = (isc__task_t *)source0;
|
||||
|
||||
isc_task_attach(isc_task_t *source, isc_task_t **targetp) {
|
||||
/*
|
||||
* Attach *targetp to source.
|
||||
*/
|
||||
@@ -361,11 +355,11 @@ isc_task_attach(isc_task_t *source0, isc_task_t **targetp) {
|
||||
|
||||
isc_refcount_increment(&source->references);
|
||||
|
||||
*targetp = (isc_task_t *)source;
|
||||
*targetp = source;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
task_shutdown(isc__task_t *task) {
|
||||
task_shutdown(isc_task_t *task) {
|
||||
bool was_idle = false;
|
||||
isc_event_t *event, *prev;
|
||||
|
||||
@@ -409,9 +403,9 @@ task_shutdown(isc__task_t *task) {
|
||||
* Caller must NOT hold queue lock.
|
||||
*/
|
||||
static inline void
|
||||
task_ready(isc__task_t *task) {
|
||||
isc__taskmgr_t *manager = task->manager;
|
||||
bool has_privilege = isc_task_privilege((isc_task_t *)task);
|
||||
task_ready(isc_task_t *task) {
|
||||
isc_taskmgr_t *manager = task->manager;
|
||||
bool has_privilege = isc_task_privilege(task);
|
||||
|
||||
REQUIRE(VALID_MANAGER(manager));
|
||||
|
||||
@@ -426,7 +420,7 @@ task_ready(isc__task_t *task) {
|
||||
}
|
||||
|
||||
static inline bool
|
||||
task_detach(isc__task_t *task) {
|
||||
task_detach(isc_task_t *task) {
|
||||
/*
|
||||
* Caller must be holding the task lock.
|
||||
*/
|
||||
@@ -454,7 +448,7 @@ task_detach(isc__task_t *task) {
|
||||
|
||||
void
|
||||
isc_task_detach(isc_task_t **taskp) {
|
||||
isc__task_t *task;
|
||||
isc_task_t *task;
|
||||
bool was_idle;
|
||||
|
||||
/*
|
||||
@@ -462,7 +456,7 @@ isc_task_detach(isc_task_t **taskp) {
|
||||
*/
|
||||
|
||||
REQUIRE(taskp != NULL);
|
||||
task = (isc__task_t *)*taskp;
|
||||
task = *taskp;
|
||||
REQUIRE(VALID_TASK(task));
|
||||
|
||||
XTRACE("isc_task_detach");
|
||||
@@ -479,7 +473,7 @@ isc_task_detach(isc_task_t **taskp) {
|
||||
}
|
||||
|
||||
static inline bool
|
||||
task_send(isc__task_t *task, isc_event_t **eventp, int c) {
|
||||
task_send(isc_task_t *task, isc_event_t **eventp, int c) {
|
||||
bool was_idle = false;
|
||||
isc_event_t *event;
|
||||
|
||||
@@ -514,8 +508,8 @@ task_send(isc__task_t *task, isc_event_t **eventp, int c) {
|
||||
}
|
||||
|
||||
void
|
||||
isc_task_send(isc_task_t *task0, isc_event_t **eventp) {
|
||||
isc_task_sendto(task0, eventp, -1);
|
||||
isc_task_send(isc_task_t *task, isc_event_t **eventp) {
|
||||
isc_task_sendto(task, eventp, -1);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -524,8 +518,7 @@ isc_task_sendanddetach(isc_task_t **taskp, isc_event_t **eventp) {
|
||||
}
|
||||
|
||||
void
|
||||
isc_task_sendto(isc_task_t *task0, isc_event_t **eventp, int c) {
|
||||
isc__task_t *task = (isc__task_t *)task0;
|
||||
isc_task_sendto(isc_task_t *task, isc_event_t **eventp, int c) {
|
||||
bool was_idle;
|
||||
|
||||
/*
|
||||
@@ -575,7 +568,7 @@ isc_task_sendto(isc_task_t *task0, isc_event_t **eventp, int c) {
|
||||
void
|
||||
isc_task_sendtoanddetach(isc_task_t **taskp, isc_event_t **eventp, int c) {
|
||||
bool idle1, idle2;
|
||||
isc__task_t *task;
|
||||
isc_task_t *task;
|
||||
|
||||
/*
|
||||
* Send '*event' to '*taskp' and then detach '*taskp' from its
|
||||
@@ -583,7 +576,7 @@ isc_task_sendtoanddetach(isc_task_t **taskp, isc_event_t **eventp, int c) {
|
||||
*/
|
||||
|
||||
REQUIRE(taskp != NULL);
|
||||
task = (isc__task_t *)*taskp;
|
||||
task = *taskp;
|
||||
REQUIRE(VALID_TASK(task));
|
||||
XTRACE("isc_task_sendanddetach");
|
||||
|
||||
@@ -616,7 +609,7 @@ isc_task_sendtoanddetach(isc_task_t **taskp, isc_event_t **eventp, int c) {
|
||||
#define PURGE_OK(event) (((event)->ev_attributes & ISC_EVENTATTR_NOPURGE) == 0)
|
||||
|
||||
static unsigned int
|
||||
dequeue_events(isc__task_t *task, void *sender, isc_eventtype_t first,
|
||||
dequeue_events(isc_task_t *task, void *sender, isc_eventtype_t first,
|
||||
isc_eventtype_t last, void *tag, isc_eventlist_t *events,
|
||||
bool purging) {
|
||||
isc_event_t *event, *next_event;
|
||||
@@ -657,9 +650,8 @@ dequeue_events(isc__task_t *task, void *sender, isc_eventtype_t first,
|
||||
}
|
||||
|
||||
unsigned int
|
||||
isc_task_purgerange(isc_task_t *task0, void *sender, isc_eventtype_t first,
|
||||
isc_task_purgerange(isc_task_t *task, void *sender, isc_eventtype_t first,
|
||||
isc_eventtype_t last, void *tag) {
|
||||
isc__task_t *task = (isc__task_t *)task0;
|
||||
unsigned int count;
|
||||
isc_eventlist_t events;
|
||||
isc_event_t *event, *next_event;
|
||||
@@ -702,8 +694,7 @@ isc_task_purge(isc_task_t *task, void *sender, isc_eventtype_t type,
|
||||
}
|
||||
|
||||
bool
|
||||
isc_task_purgeevent(isc_task_t *task0, isc_event_t *event) {
|
||||
isc__task_t *task = (isc__task_t *)task0;
|
||||
isc_task_purgeevent(isc_task_t *task, isc_event_t *event) {
|
||||
isc_event_t *curr_event, *next_event;
|
||||
|
||||
/*
|
||||
@@ -756,7 +747,7 @@ isc_task_unsendrange(isc_task_t *task, void *sender, isc_eventtype_t first,
|
||||
|
||||
XTRACE("isc_task_unsendrange");
|
||||
|
||||
return (dequeue_events((isc__task_t *)task, sender, first, last, tag,
|
||||
return (dequeue_events((isc_task_t *)task, sender, first, last, tag,
|
||||
events, false));
|
||||
}
|
||||
|
||||
@@ -769,13 +760,12 @@ isc_task_unsend(isc_task_t *task, void *sender, isc_eventtype_t type, void *tag,
|
||||
|
||||
XTRACE("isc_task_unsend");
|
||||
|
||||
return (dequeue_events((isc__task_t *)task, sender, type, type, tag,
|
||||
return (dequeue_events((isc_task_t *)task, sender, type, type, tag,
|
||||
events, false));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_task_onshutdown(isc_task_t *task0, isc_taskaction_t action, void *arg) {
|
||||
isc__task_t *task = (isc__task_t *)task0;
|
||||
isc_task_onshutdown(isc_task_t *task, isc_taskaction_t action, void *arg) {
|
||||
bool disallowed = false;
|
||||
isc_result_t result = ISC_R_SUCCESS;
|
||||
isc_event_t *event;
|
||||
@@ -809,8 +799,7 @@ isc_task_onshutdown(isc_task_t *task0, isc_taskaction_t action, void *arg) {
|
||||
}
|
||||
|
||||
void
|
||||
isc_task_shutdown(isc_task_t *task0) {
|
||||
isc__task_t *task = (isc__task_t *)task0;
|
||||
isc_task_shutdown(isc_task_t *task) {
|
||||
bool was_idle;
|
||||
|
||||
/*
|
||||
@@ -841,9 +830,7 @@ isc_task_destroy(isc_task_t **taskp) {
|
||||
}
|
||||
|
||||
void
|
||||
isc_task_setname(isc_task_t *task0, const char *name, void *tag) {
|
||||
isc__task_t *task = (isc__task_t *)task0;
|
||||
|
||||
isc_task_setname(isc_task_t *task, const char *name, void *tag) {
|
||||
/*
|
||||
* Name 'task'.
|
||||
*/
|
||||
@@ -857,27 +844,21 @@ isc_task_setname(isc_task_t *task0, const char *name, void *tag) {
|
||||
}
|
||||
|
||||
const char *
|
||||
isc_task_getname(isc_task_t *task0) {
|
||||
isc__task_t *task = (isc__task_t *)task0;
|
||||
|
||||
isc_task_getname(isc_task_t *task) {
|
||||
REQUIRE(VALID_TASK(task));
|
||||
|
||||
return (task->name);
|
||||
}
|
||||
|
||||
void *
|
||||
isc_task_gettag(isc_task_t *task0) {
|
||||
isc__task_t *task = (isc__task_t *)task0;
|
||||
|
||||
isc_task_gettag(isc_task_t *task) {
|
||||
REQUIRE(VALID_TASK(task));
|
||||
|
||||
return (task->tag);
|
||||
}
|
||||
|
||||
void
|
||||
isc_task_getcurrenttime(isc_task_t *task0, isc_stdtime_t *t) {
|
||||
isc__task_t *task = (isc__task_t *)task0;
|
||||
|
||||
isc_task_getcurrenttime(isc_task_t *task, isc_stdtime_t *t) {
|
||||
REQUIRE(VALID_TASK(task));
|
||||
REQUIRE(t != NULL);
|
||||
|
||||
@@ -887,9 +868,7 @@ isc_task_getcurrenttime(isc_task_t *task0, isc_stdtime_t *t) {
|
||||
}
|
||||
|
||||
void
|
||||
isc_task_getcurrenttimex(isc_task_t *task0, isc_time_t *t) {
|
||||
isc__task_t *task = (isc__task_t *)task0;
|
||||
|
||||
isc_task_getcurrenttimex(isc_task_t *task, isc_time_t *t) {
|
||||
REQUIRE(VALID_TASK(task));
|
||||
REQUIRE(t != NULL);
|
||||
|
||||
@@ -910,7 +889,7 @@ isc_task_getcurrenttimex(isc_task_t *task0, isc_time_t *t) {
|
||||
* Caller must hold the task manager lock.
|
||||
*/
|
||||
static inline bool
|
||||
empty_readyq(isc__taskmgr_t *manager, int c) {
|
||||
empty_readyq(isc_taskmgr_t *manager, int c) {
|
||||
isc__tasklist_t queue;
|
||||
|
||||
if (atomic_load_relaxed(&manager->mode) == isc_taskmgrmode_normal) {
|
||||
@@ -929,9 +908,9 @@ empty_readyq(isc__taskmgr_t *manager, int c) {
|
||||
*
|
||||
* Caller must hold the task manager lock.
|
||||
*/
|
||||
static inline isc__task_t *
|
||||
pop_readyq(isc__taskmgr_t *manager, int c) {
|
||||
isc__task_t *task;
|
||||
static inline isc_task_t *
|
||||
pop_readyq(isc_taskmgr_t *manager, int c) {
|
||||
isc_task_t *task;
|
||||
|
||||
if (atomic_load_relaxed(&manager->mode) == isc_taskmgrmode_normal) {
|
||||
task = HEAD(manager->queues[c].ready_tasks);
|
||||
@@ -957,7 +936,7 @@ pop_readyq(isc__taskmgr_t *manager, int c) {
|
||||
* Caller must hold the task queue lock.
|
||||
*/
|
||||
static inline void
|
||||
push_readyq(isc__taskmgr_t *manager, isc__task_t *task, int c) {
|
||||
push_readyq(isc_taskmgr_t *manager, isc_task_t *task, int c) {
|
||||
if (ISC_LINK_LINKED(task, ready_link)) {
|
||||
return;
|
||||
}
|
||||
@@ -971,8 +950,8 @@ push_readyq(isc__taskmgr_t *manager, isc__task_t *task, int c) {
|
||||
}
|
||||
|
||||
static void
|
||||
dispatch(isc__taskmgr_t *manager, unsigned int threadid) {
|
||||
isc__task_t *task;
|
||||
dispatch(isc_taskmgr_t *manager, unsigned int threadid) {
|
||||
isc_task_t *task;
|
||||
|
||||
REQUIRE(VALID_MANAGER(manager));
|
||||
|
||||
@@ -1336,7 +1315,7 @@ static isc_threadresult_t
|
||||
#endif /* ifdef _WIN32 */
|
||||
run(void *queuep) {
|
||||
isc__taskqueue_t *tq = queuep;
|
||||
isc__taskmgr_t *manager = tq->manager;
|
||||
isc_taskmgr_t *manager = tq->manager;
|
||||
int threadid = tq->threadid;
|
||||
isc_thread_setaffinity(threadid);
|
||||
|
||||
@@ -1354,7 +1333,7 @@ static isc_threadresult_t
|
||||
}
|
||||
|
||||
static void
|
||||
manager_free(isc__taskmgr_t *manager) {
|
||||
manager_free(isc_taskmgr_t *manager) {
|
||||
for (unsigned int i = 0; i < manager->workers; i++) {
|
||||
isc_mutex_destroy(&manager->queues[i].lock);
|
||||
isc_condition_destroy(&manager->queues[i].work_available);
|
||||
@@ -1365,8 +1344,7 @@ manager_free(isc__taskmgr_t *manager) {
|
||||
isc_condition_destroy(&manager->halt_cond);
|
||||
isc_mem_put(manager->mctx, manager->queues,
|
||||
manager->workers * sizeof(isc__taskqueue_t));
|
||||
manager->common.impmagic = 0;
|
||||
manager->common.magic = 0;
|
||||
manager->magic = 0;
|
||||
isc_mem_putanddetach(&manager->mctx, manager, sizeof(*manager));
|
||||
}
|
||||
|
||||
@@ -1375,7 +1353,7 @@ isc_taskmgr_create(isc_mem_t *mctx, unsigned int workers,
|
||||
unsigned int default_quantum, isc_nm_t *nm,
|
||||
isc_taskmgr_t **managerp) {
|
||||
unsigned int i;
|
||||
isc__taskmgr_t *manager;
|
||||
isc_taskmgr_t *manager;
|
||||
|
||||
/*
|
||||
* Create a new task manager.
|
||||
@@ -1385,8 +1363,7 @@ isc_taskmgr_create(isc_mem_t *mctx, unsigned int workers,
|
||||
REQUIRE(managerp != NULL && *managerp == NULL);
|
||||
|
||||
manager = isc_mem_get(mctx, sizeof(*manager));
|
||||
*manager = (isc__taskmgr_t){ .common.impmagic = TASK_MANAGER_MAGIC,
|
||||
.common.magic = ISCAPI_TASKMGR_MAGIC };
|
||||
*manager = (isc_taskmgr_t){ .magic = TASK_MANAGER_MAGIC };
|
||||
|
||||
atomic_store(&manager->mode, isc_taskmgrmode_normal);
|
||||
isc_mutex_init(&manager->lock);
|
||||
@@ -1449,8 +1426,8 @@ isc_taskmgr_create(isc_mem_t *mctx, unsigned int workers,
|
||||
|
||||
void
|
||||
isc_taskmgr_destroy(isc_taskmgr_t **managerp) {
|
||||
isc__taskmgr_t *manager;
|
||||
isc__task_t *task;
|
||||
isc_taskmgr_t *manager;
|
||||
isc_task_t *task;
|
||||
unsigned int i;
|
||||
bool exiting;
|
||||
|
||||
@@ -1459,7 +1436,7 @@ isc_taskmgr_destroy(isc_taskmgr_t **managerp) {
|
||||
*/
|
||||
|
||||
REQUIRE(managerp != NULL);
|
||||
manager = (isc__taskmgr_t *)*managerp;
|
||||
manager = (isc_taskmgr_t *)*managerp;
|
||||
REQUIRE(VALID_MANAGER(manager));
|
||||
|
||||
XTHREADTRACE("isc_taskmgr_destroy");
|
||||
@@ -1549,20 +1526,20 @@ isc_taskmgr_destroy(isc_taskmgr_t **managerp) {
|
||||
|
||||
void
|
||||
isc_taskmgr_setprivilegedmode(isc_taskmgr_t *manager0) {
|
||||
isc__taskmgr_t *manager = (isc__taskmgr_t *)manager0;
|
||||
isc_taskmgr_t *manager = (isc_taskmgr_t *)manager0;
|
||||
|
||||
atomic_store(&manager->mode, isc_taskmgrmode_privileged);
|
||||
}
|
||||
|
||||
isc_taskmgrmode_t
|
||||
isc_taskmgr_mode(isc_taskmgr_t *manager0) {
|
||||
isc__taskmgr_t *manager = (isc__taskmgr_t *)manager0;
|
||||
isc_taskmgr_t *manager = (isc_taskmgr_t *)manager0;
|
||||
return (atomic_load(&manager->mode));
|
||||
}
|
||||
|
||||
void
|
||||
isc__taskmgr_pause(isc_taskmgr_t *manager0) {
|
||||
isc__taskmgr_t *manager = (isc__taskmgr_t *)manager0;
|
||||
isc_taskmgr_t *manager = (isc_taskmgr_t *)manager0;
|
||||
|
||||
LOCK(&manager->halt_lock);
|
||||
while (atomic_load_relaxed(&manager->exclusive_req) ||
|
||||
@@ -1584,7 +1561,7 @@ isc__taskmgr_pause(isc_taskmgr_t *manager0) {
|
||||
|
||||
void
|
||||
isc__taskmgr_resume(isc_taskmgr_t *manager0) {
|
||||
isc__taskmgr_t *manager = (isc__taskmgr_t *)manager0;
|
||||
isc_taskmgr_t *manager = (isc_taskmgr_t *)manager0;
|
||||
LOCK(&manager->halt_lock);
|
||||
if (atomic_load(&manager->pause_req)) {
|
||||
atomic_store(&manager->pause_req, false);
|
||||
@@ -1597,23 +1574,19 @@ isc__taskmgr_resume(isc_taskmgr_t *manager0) {
|
||||
}
|
||||
|
||||
void
|
||||
isc_taskmgr_setexcltask(isc_taskmgr_t *mgr0, isc_task_t *task0) {
|
||||
isc__taskmgr_t *mgr = (isc__taskmgr_t *)mgr0;
|
||||
isc__task_t *task = (isc__task_t *)task0;
|
||||
|
||||
isc_taskmgr_setexcltask(isc_taskmgr_t *mgr, isc_task_t *task) {
|
||||
REQUIRE(VALID_MANAGER(mgr));
|
||||
REQUIRE(VALID_TASK(task));
|
||||
LOCK(&mgr->excl_lock);
|
||||
if (mgr->excl != NULL) {
|
||||
isc_task_detach((isc_task_t **)&mgr->excl);
|
||||
}
|
||||
isc_task_attach(task0, (isc_task_t **)&mgr->excl);
|
||||
isc_task_attach(task, (isc_task_t **)&mgr->excl);
|
||||
UNLOCK(&mgr->excl_lock);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_taskmgr_excltask(isc_taskmgr_t *mgr0, isc_task_t **taskp) {
|
||||
isc__taskmgr_t *mgr = (isc__taskmgr_t *)mgr0;
|
||||
isc_taskmgr_excltask(isc_taskmgr_t *mgr, isc_task_t **taskp) {
|
||||
isc_result_t result = ISC_R_SUCCESS;
|
||||
|
||||
REQUIRE(VALID_MANAGER(mgr));
|
||||
@@ -1631,9 +1604,8 @@ isc_taskmgr_excltask(isc_taskmgr_t *mgr0, isc_task_t **taskp) {
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_task_beginexclusive(isc_task_t *task0) {
|
||||
isc__task_t *task = (isc__task_t *)task0;
|
||||
isc__taskmgr_t *manager;
|
||||
isc_task_beginexclusive(isc_task_t *task) {
|
||||
isc_taskmgr_t *manager;
|
||||
|
||||
REQUIRE(VALID_TASK(task));
|
||||
|
||||
@@ -1669,9 +1641,8 @@ isc_task_beginexclusive(isc_task_t *task0) {
|
||||
}
|
||||
|
||||
void
|
||||
isc_task_endexclusive(isc_task_t *task0) {
|
||||
isc__task_t *task = (isc__task_t *)task0;
|
||||
isc__taskmgr_t *manager;
|
||||
isc_task_endexclusive(isc_task_t *task) {
|
||||
isc_taskmgr_t *manager;
|
||||
|
||||
REQUIRE(VALID_TASK(task));
|
||||
REQUIRE(task->state == task_state_running);
|
||||
@@ -1691,9 +1662,8 @@ isc_task_endexclusive(isc_task_t *task0) {
|
||||
}
|
||||
|
||||
void
|
||||
isc_task_pause(isc_task_t *task0) {
|
||||
REQUIRE(ISCAPI_TASK_VALID(task0));
|
||||
isc__task_t *task = (isc__task_t *)task0;
|
||||
isc_task_pause(isc_task_t *task) {
|
||||
REQUIRE(VALID_TASK(task));
|
||||
|
||||
LOCK(&task->lock);
|
||||
task->pause_cnt++;
|
||||
@@ -1718,11 +1688,10 @@ isc_task_pause(isc_task_t *task0) {
|
||||
}
|
||||
|
||||
void
|
||||
isc_task_unpause(isc_task_t *task0) {
|
||||
isc__task_t *task = (isc__task_t *)task0;
|
||||
isc_task_unpause(isc_task_t *task) {
|
||||
bool was_idle = false;
|
||||
|
||||
REQUIRE(ISCAPI_TASK_VALID(task0));
|
||||
REQUIRE(VALID_TASK(task));
|
||||
|
||||
LOCK(&task->lock);
|
||||
task->pause_cnt--;
|
||||
@@ -1752,10 +1721,9 @@ isc_task_unpause(isc_task_t *task0) {
|
||||
}
|
||||
|
||||
void
|
||||
isc_task_setprivilege(isc_task_t *task0, bool priv) {
|
||||
REQUIRE(ISCAPI_TASK_VALID(task0));
|
||||
isc__task_t *task = (isc__task_t *)task0;
|
||||
isc__taskmgr_t *manager = task->manager;
|
||||
isc_task_setprivilege(isc_task_t *task, bool priv) {
|
||||
REQUIRE(VALID_TASK(task));
|
||||
isc_taskmgr_t *manager = task->manager;
|
||||
uint_fast32_t oldflags, newflags;
|
||||
|
||||
oldflags = atomic_load_acquire(&task->flags);
|
||||
@@ -1783,8 +1751,7 @@ isc_task_setprivilege(isc_task_t *task0, bool priv) {
|
||||
}
|
||||
|
||||
bool
|
||||
isc_task_privilege(isc_task_t *task0) {
|
||||
isc__task_t *task = (isc__task_t *)task0;
|
||||
isc_task_privilege(isc_task_t *task) {
|
||||
REQUIRE(VALID_TASK(task));
|
||||
|
||||
return (TASK_PRIVILEGED(task));
|
||||
@@ -1792,7 +1759,7 @@ isc_task_privilege(isc_task_t *task0) {
|
||||
|
||||
bool
|
||||
isc_task_exiting(isc_task_t *t) {
|
||||
isc__task_t *task = (isc__task_t *)t;
|
||||
isc_task_t *task = (isc_task_t *)t;
|
||||
REQUIRE(VALID_TASK(task));
|
||||
|
||||
return (TASK_SHUTTINGDOWN(task));
|
||||
@@ -1806,9 +1773,8 @@ isc_task_exiting(isc_task_t *t) {
|
||||
goto error; \
|
||||
} while (0)
|
||||
int
|
||||
isc_taskmgr_renderxml(isc_taskmgr_t *mgr0, void *writer0) {
|
||||
isc__taskmgr_t *mgr = (isc__taskmgr_t *)mgr0;
|
||||
isc__task_t *task = NULL;
|
||||
isc_taskmgr_renderxml(isc_taskmgr_t *mgr, void *writer0) {
|
||||
isc_task_t *task = NULL;
|
||||
int xmlrc;
|
||||
xmlTextWriterPtr writer = (xmlTextWriterPtr)writer0;
|
||||
|
||||
@@ -1916,10 +1882,9 @@ error:
|
||||
} while (0)
|
||||
|
||||
isc_result_t
|
||||
isc_taskmgr_renderjson(isc_taskmgr_t *mgr0, void *tasks0) {
|
||||
isc_taskmgr_renderjson(isc_taskmgr_t *mgr, void *tasks0) {
|
||||
isc_result_t result = ISC_R_SUCCESS;
|
||||
isc__taskmgr_t *mgr = (isc__taskmgr_t *)mgr0;
|
||||
isc__task_t *task = NULL;
|
||||
isc_task_t *task = NULL;
|
||||
json_object *obj = NULL, *array = NULL, *taskobj = NULL;
|
||||
json_object *tasks = (json_object *)tasks0;
|
||||
|
||||
|
Reference in New Issue
Block a user