mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-01-05 03:29:35 +00:00
MEDIUM: poller: use atomic ops to update the fdtab mask
We don't need to lock the fdtab[].lock anymore since we only have one modification left (update update_mask). Let's use an atomic AND instead.
This commit is contained in:
parent
4d84186337
commit
62a627ac19
@ -79,10 +79,8 @@ REGPRM2 static void _do_poll(struct poller *p, int exp)
|
||||
continue;
|
||||
}
|
||||
|
||||
HA_SPIN_LOCK(FD_LOCK, &fdtab[fd].lock);
|
||||
fdtab[fd].update_mask &= ~tid_bit;
|
||||
en = fdtab[fd].state;
|
||||
HA_SPIN_UNLOCK(FD_LOCK, &fdtab[fd].lock);
|
||||
HA_ATOMIC_AND(&fdtab[fd].update_mask, ~tid_bit);
|
||||
|
||||
if (fdtab[fd].polled_mask & tid_bit) {
|
||||
if (!(fdtab[fd].thread_mask & tid_bit) || !(en & FD_EV_POLLED_RW)) {
|
||||
|
@ -52,10 +52,8 @@ REGPRM2 static void _do_poll(struct poller *p, int exp)
|
||||
continue;
|
||||
}
|
||||
|
||||
HA_SPIN_LOCK(FD_LOCK, &fdtab[fd].lock);
|
||||
fdtab[fd].update_mask &= ~tid_bit;
|
||||
en = fdtab[fd].state;
|
||||
HA_SPIN_UNLOCK(FD_LOCK, &fdtab[fd].lock);
|
||||
HA_ATOMIC_AND(&fdtab[fd].update_mask, ~tid_bit);
|
||||
|
||||
if (!(fdtab[fd].thread_mask & tid_bit) || !(en & FD_EV_POLLED_RW)) {
|
||||
if (!(fdtab[fd].polled_mask & tid_bit)) {
|
||||
|
@ -70,10 +70,8 @@ REGPRM2 static void _do_poll(struct poller *p, int exp)
|
||||
continue;
|
||||
}
|
||||
|
||||
HA_SPIN_LOCK(FD_LOCK, &fdtab[fd].lock);
|
||||
fdtab[fd].update_mask &= ~tid_bit;
|
||||
en = fdtab[fd].state;
|
||||
HA_SPIN_UNLOCK(FD_LOCK, &fdtab[fd].lock);
|
||||
HA_ATOMIC_AND(&fdtab[fd].update_mask, ~tid_bit);
|
||||
|
||||
/* we have a single state for all threads, which is why we
|
||||
* don't check the tid_bit. First thread to see the update
|
||||
|
@ -62,10 +62,8 @@ REGPRM2 static void _do_poll(struct poller *p, int exp)
|
||||
continue;
|
||||
}
|
||||
|
||||
HA_SPIN_LOCK(FD_LOCK, &fdtab[fd].lock);
|
||||
fdtab[fd].update_mask &= ~tid_bit;
|
||||
en = fdtab[fd].state;
|
||||
HA_SPIN_UNLOCK(FD_LOCK, &fdtab[fd].lock);
|
||||
HA_ATOMIC_AND(&fdtab[fd].update_mask, ~tid_bit);
|
||||
|
||||
/* we have a single state for all threads, which is why we
|
||||
* don't check the tid_bit. First thread to see the update
|
||||
|
Loading…
Reference in New Issue
Block a user