]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: sched: implement task_kill() to kill a task
authorWilly Tarreau <w@1wt.eu>
Tue, 30 Jun 2020 09:48:48 +0000 (11:48 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 1 Jul 2020 14:35:53 +0000 (16:35 +0200)
commiteb8c2c69fa0e75569df80e040da6424dbc181682
tree7655d62bd57f7dc5419df16d40180b764a6f6781
parent8a6049c2680fe1bdacf53a90e4c3ff97bc791ec9
MEDIUM: sched: implement task_kill() to kill a task

task_kill() may be used by any thread to kill any task with less overhead
than a regular wakeup. In order to achieve this, it bypasses the priority
tree and inserts the task directly into the shared tasklets list, cast as
a tasklet. The task_list_size is updated to make sure it is properly
decremented after execution of this task. The task will thus be picked by
process_runnable_tasks() after checking the tree and sent to the TL_URGENT
list, where it will be processed and killed.

If the task is bound to more than one thread, its first thread will be the
one notified.

If the task was already queued or running, nothing is done, only the flag
is added so that it gets killed before or after execution. Of course it's
the caller's responsibility to make sur any resources allocated by this
task were already cleaned up or taken over.
include/haproxy/task.h
src/task.c