]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: fd: add functions to manipulate the FD's tgid
authorWilly Tarreau <w@1wt.eu>
Wed, 6 Jul 2022 16:27:13 +0000 (18:27 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 15 Jul 2022 18:16:09 +0000 (20:16 +0200)
commit080373ea3896781963f647fd1dcea30ab46fa50f
treeed247e4d3eaac49981b2ed4b0210debb3996ef1e
parentc2431823703a09966c888fdf716b4f731f4893af
MINOR: fd: add functions to manipulate the FD's tgid

The FD's tgid is refcounted and must be atomically manipulated. Function
fd_grab_tgid() will increase the refcount but only if the tgid matches the
one in argument (likely the current one). fd_claim_tgid() will be used to
self-assign the tgid after waiting for its refcount to reach zero.
fd_drop_tgid() will be used to drop a temporarily held tgid. All of these
are needed to prevent an FD from being reassigned to another group, either
when inspecting/modifying the running_mask, or when checking for updates,
in order to be certain that the mask being seen corresponds to the desired
group. Note that once at least one bit is set in the running mask of an
active FD, it cannot be closed, thus not migrated, thus the reference does
not need to be held long.
include/haproxy/fd.h