MINOR: fd: implement fd_migrate_on() to migrate on a non-local thread
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 3 Apr 2023 13:27:13 +0000 (15:27 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 13 Apr 2023 14:57:51 +0000 (16:57 +0200)
commit53fc98c3bcf058e358a4a9b3ad3b35ce883085fb
treecf9b37d9abe85982e2c9d14561a5ebd1b91b00b5
parent7b44c26e136a9d215e4b102a9e9a66731666ede8
MINOR: fd: implement fd_migrate_on() to migrate on a non-local thread

fd_migrate_on() can be used to migrate an existing FD to any thread, even
one belonging to a different group from the current one and from the
caller's. All that is needed is to make sure the FD is still valid when
the operation is performed (which is the case when such operations happen).

This is potentially slightly expensive since it locks the tgid during the
delicate operation, but it is normally performed only from an owning
thread to offer the FD to another one (e.g. reassign a better thread upon
accept()).
include/haproxy/fd.h
src/fd.c