From: Olivier Houchard Date: Tue, 28 Apr 2026 16:09:19 +0000 (+0200) Subject: MINOR: tasks: Introduce __task_get_current_owner X-Git-Tag: v3.5-dev1~55 X-Git-Url: http://git.kaiwu.me/postgresql/log/contrib/postgres_fdw/static/gitweb.js?a=commitdiff_plain;h=74b16c5477c16f8e44237d6d87ecb83945d6c289;p=haproxy.git MINOR: tasks: Introduce __task_get_current_owner Introduce a new function, __task_get_current_owner, that returns the owner of a task based on its current tid. -1 means there is no current owner, otherwise either the tid is >= 0, in which case it will just return it, or it's < -1, in which case it will return -2 - tid, the tid of the thread with the current ownership. --- diff --git a/include/haproxy/task.h b/include/haproxy/task.h index df4b42ea5..8608f6fda 100644 --- a/include/haproxy/task.h +++ b/include/haproxy/task.h @@ -269,6 +269,13 @@ static inline int __task_get_new_tid_field(int curtid) return -2 - tid; } +static inline int __task_get_current_owner(int curtid) +{ + if (curtid >= 0 || curtid == -1) + return curtid; + return ~(curtid + 1); +} + /* puts the task in run queue with reason flags , and returns */ /* This will put the task in the local runqueue if the task is only runnable * by the current thread, in the global runqueue otherwies. With DEBUG_TASK,