]> git.ipfire.org Git - thirdparty/bind9.git/commit
Make isc_task_pause/isc_task_unpause thread safe. wpk/task-pausing-thread-safety
authorWitold Kręcicki <wpk@isc.org>
Tue, 28 Jan 2020 08:08:10 +0000 (09:08 +0100)
committerWitold Kręcicki <wpk@isc.org>
Thu, 13 Feb 2020 13:40:13 +0000 (14:40 +0100)
commit70c463a69df0934089b3d34bb6ff96792682e223
treebebe9f8747a9692168f2f158182db7bb10f5a756
parentc823ed4f07e7417ff50bad63597f817b025ac5de
Make isc_task_pause/isc_task_unpause thread safe.

isc_task_pause/unpause were inherently thread-unsafe - a task
could be paused only once by one thread, if the task was running
while we paused it it led to races. Fix it by making sure that
the task will pause if requested to, and by using a 'pause reference
counter' to count task pause requests - a task will be unpaused
iff all threads unpause it.

Don't remove from queue when pausing task - we lock the queue lock
(expensive), while it's unlikely that the task will be running -
and we'll remove it anyway in dispatcher
lib/isc/task.c