mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 06:25:31 +00:00
Fix a few broken atomics initializations
This commit is contained in:
@@ -229,7 +229,7 @@ task_finished(isc__task_t *task) {
|
||||
REQUIRE(EMPTY(task->events));
|
||||
REQUIRE(task->nevents == 0);
|
||||
REQUIRE(EMPTY(task->on_shutdown));
|
||||
REQUIRE(task->references == 0);
|
||||
REQUIRE(atomic_load(&task->references) == 0);
|
||||
REQUIRE(task->state == task_state_done);
|
||||
|
||||
XTRACE("task_finished");
|
||||
@@ -1243,7 +1243,8 @@ dispatch(isc__taskmgr_t *manager, unsigned int threadid) {
|
||||
* we're stuck. Automatically drop privileges at that
|
||||
* point and continue with the regular ready queue.
|
||||
*/
|
||||
if (manager->mode != isc_taskmgrmode_normal &&
|
||||
if (atomic_load_relaxed(&manager->mode) !=
|
||||
isc_taskmgrmode_normal &&
|
||||
atomic_load_explicit(&manager->tasks_running,
|
||||
memory_order_acquire) == 0)
|
||||
{
|
||||
@@ -1256,7 +1257,8 @@ dispatch(isc__taskmgr_t *manager, unsigned int threadid) {
|
||||
* we'll end up in a deadlock over queue locks.
|
||||
*
|
||||
*/
|
||||
if (manager->mode != isc_taskmgrmode_normal &&
|
||||
if (atomic_load(&manager->mode) !=
|
||||
isc_taskmgrmode_normal &&
|
||||
atomic_load_explicit(&manager->tasks_running,
|
||||
memory_order_acquire) == 0)
|
||||
{
|
||||
@@ -1360,10 +1362,10 @@ isc_taskmgr_create(isc_mem_t *mctx, unsigned int workers,
|
||||
manager->queues = isc_mem_get(mctx, workers * sizeof(isc__taskqueue_t));
|
||||
RUNTIME_CHECK(manager->queues != NULL);
|
||||
|
||||
manager->tasks_running = 0;
|
||||
manager->tasks_ready = 0;
|
||||
manager->curq = 0;
|
||||
manager->exiting = false;
|
||||
atomic_init(&manager->tasks_running, 0);
|
||||
atomic_init(&manager->tasks_ready, 0);
|
||||
atomic_init(&manager->curq, 0);
|
||||
atomic_init(&manager->exiting, false);
|
||||
manager->excl = NULL;
|
||||
manager->halted = 0;
|
||||
atomic_store_relaxed(&manager->exclusive_req, false);
|
||||
@@ -1529,8 +1531,8 @@ void
|
||||
isc__taskmgr_resume(isc_taskmgr_t *manager0) {
|
||||
isc__taskmgr_t *manager = (isc__taskmgr_t *)manager0;
|
||||
LOCK(&manager->halt_lock);
|
||||
if (manager->pause_req) {
|
||||
manager->pause_req = false;
|
||||
if (atomic_load(&manager->pause_req)) {
|
||||
atomic_store(&manager->pause_req, false);
|
||||
while (manager->halted > 0) {
|
||||
BROADCAST(&manager->halt_cond);
|
||||
WAIT(&manager->halt_cond, &manager->halt_lock);
|
||||
|
Reference in New Issue
Block a user