do {
if (update_mask == fdtab[fd].thread_mask)
return;
- } while (!_HA_ATOMIC_CAS(&fdtab[fd].update_mask, &update_mask,
- fdtab[fd].thread_mask));
+ } while (!_HA_ATOMIC_CAS(&fdtab[fd].update_mask, &update_mask, fdtab[fd].thread_mask));
+
fd_add_to_fd_list(&update_list, fd, offsetof(struct fdtab, update));
+
+ if (fd_active(fd) &&
+ !(fdtab[fd].thread_mask & tid_bit) &&
+ (fdtab[fd].thread_mask & ~tid_bit & all_threads_mask & ~sleeping_thread_mask) == 0) {
+ /* we need to wake up one thread to handle it immediately */
+ int thr = my_ffsl(fdtab[fd].thread_mask & ~tid_bit & all_threads_mask) - 1;
+
+ _HA_ATOMIC_AND(&sleeping_thread_mask, ~(1UL << thr));
+ wake_thread(thr);
+ }
}
}