From: Olivier Houchard Date: Tue, 17 Mar 2020 17:15:04 +0000 (+0100) Subject: MINOR: tasks: Provide the tasklet to the callback. X-Git-Tag: v2.2-dev5~40 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c62d9ab7cb65fc9d0c7383dbb46e123da096385d;p=thirdparty%2Fhaproxy.git MINOR: tasks: Provide the tasklet to the callback. When tasklet were introduced, it has been decided not to provide the tasklet to the callback, but NULL instead. While it may have been reasonable back then, maybe to be able to differentiate a task from a tasklet from the callback, it also means that we can't access the tasklet from the handler if the context provided can't be trusted. As no handler is shared between a task and a tasklet, and there are now other means of distinguishing between task and tasklet, just pass the tasklet pointer too. This may be backported to 2.1, 2.0 and 1.9 if needed. --- diff --git a/src/task.c b/src/task.c index 2952d2ad39..e6be24026c 100644 --- a/src/task.c +++ b/src/task.c @@ -342,7 +342,7 @@ int run_tasks_from_list(struct list *list, int max) state = _HA_ATOMIC_XCHG(&t->state, state); __ha_barrier_atomic_store(); __tasklet_remove_from_tasklet_list((struct tasklet *)t); - process(NULL, ctx, state); + process(t, ctx, state); done++; sched->current = NULL; __ha_barrier_store();