MEDIUM: fd: use atomic ops for hap_fd_{clr,set} and remove poll_lock
Now that we can use atomic ops to set/clear an fd occurrence in an
fd_set, we don't need the poll_lock anymore. Let's remove it.
diff --git a/include/common/hathreads.h b/include/common/hathreads.h
index fe1ee23..0ec1ad8 100644
--- a/include/common/hathreads.h
+++ b/include/common/hathreads.h
@@ -205,7 +205,6 @@
THREAD_SYNC_LOCK = 0,
FDCACHE_LOCK,
FD_LOCK,
- POLL_LOCK,
TASK_RQ_LOCK,
TASK_WQ_LOCK,
POOL_LOCK,
diff --git a/include/proto/fd.h b/include/proto/fd.h
index fcf026e..0dd3e84 100644
--- a/include/proto/fd.h
+++ b/include/proto/fd.h
@@ -41,7 +41,6 @@
extern THREAD_LOCAL int fd_nbupdt; // number of updates in the list
__decl_hathreads(extern HA_RWLOCK_T __attribute__((aligned(64))) fdcache_lock); /* global lock to protect fd_cache array */
-__decl_hathreads(extern HA_SPINLOCK_T __attribute__((aligned(64))) poll_lock); /* global lock to protect poll info */
/* Deletes an FD from the fdsets.
* The file descriptor is also closed.
@@ -412,12 +411,12 @@
/* These are replacements for FD_SET, FD_CLR, FD_ISSET, working on uints */
static inline void hap_fd_set(int fd, unsigned int *evts)
{
- evts[fd / (8*sizeof(*evts))] |= 1U << (fd & (8*sizeof(*evts) - 1));
+ HA_ATOMIC_OR(&evts[fd / (8*sizeof(*evts))], 1U << (fd & (8*sizeof(*evts) - 1)));
}
static inline void hap_fd_clr(int fd, unsigned int *evts)
{
- evts[fd / (8*sizeof(*evts))] &= ~(1U << (fd & (8*sizeof(*evts) - 1)));
+ HA_ATOMIC_AND(&evts[fd / (8*sizeof(*evts))], ~(1U << (fd & (8*sizeof(*evts) - 1))));
}
static inline unsigned int hap_fd_isset(int fd, unsigned int *evts)