From: Willy Tarreau Date: Tue, 3 Aug 2021 07:15:32 +0000 (+0200) Subject: CLEANUP: fd: remove the now unused fd_set_running() X-Git-Tag: v2.5-dev4~70 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b201b1dab1eff5d2aaed263d5575c99bef7cd17b;p=thirdparty%2Fhaproxy.git CLEANUP: fd: remove the now unused fd_set_running() It was inlined inside fd_update_events() since it relies on a loop that may return immediate failure codes. --- diff --git a/include/haproxy/fd.h b/include/haproxy/fd.h index 8e1a442a32..5e9a96739e 100644 --- a/include/haproxy/fd.h +++ b/include/haproxy/fd.h @@ -311,37 +311,6 @@ static inline void fd_want_send(int fd) updt_fd_polling(fd); } -/* Set the fd as currently running on the current thread. - * Returns 0 if all goes well, or -1 if we no longer own the fd, and should - * do nothing with it. - */ -static inline int fd_set_running(int fd) -{ -#ifndef HA_HAVE_CAS_DW - HA_RWLOCK_RDLOCK(OTHER_LOCK, &fd_mig_lock); - if (!(fdtab[fd].thread_mask & tid_bit)) { - HA_RWLOCK_RDUNLOCK(OTHER_LOCK, &fd_mig_lock); - return -1; - } - _HA_ATOMIC_OR(&fdtab[fd].running_mask, tid_bit); - HA_RWLOCK_RDUNLOCK(OTHER_LOCK, &fd_mig_lock); - return 0; -#else - unsigned long old_masks[2]; - unsigned long new_masks[2]; - old_masks[0] = fdtab[fd].running_mask; - old_masks[1] = fdtab[fd].thread_mask; - do { - if (!(old_masks[1] & tid_bit)) - return -1; - new_masks[0] = fdtab[fd].running_mask | tid_bit; - new_masks[1] = old_masks[1]; - - } while (!(HA_ATOMIC_DWCAS(&fdtab[fd].running_mask, &old_masks, &new_masks))); - return 0; -#endif -} - /* remove tid_bit from the fd's running mask and returns the bits that remain * after the atomic operation. */