[PATCH xserver 03/20] os: Implement support for NotifyFd X_NOTIFY_WRITE
Adam Jackson
ajax at nwnk.net
Tue Nov 17 12:10:59 PST 2015
On Wed, 2015-11-11 at 22:02 -0800, Keith Packard wrote:
> @@ -1174,12 +1192,16 @@ SetNotifyFd(int fd, NotifyFdProcPtr notify, int mask, void *data)
> void
> HandleNotifyFds(void)
> {
> - struct notify_fd *s, *next;
> -
> - xorg_list_for_each_entry_safe(s, next, ¬ify_fds, list) {
> - if (FD_ISSET(s->fd, &LastSelectMask)) {
> - s->notify(s->fd, X_NOTIFY_READ, s->data);
> - }
> + struct notify_fd *n, *next;
> +
> + xorg_list_for_each_entry_safe(n, next, ¬ify_fds, list) {
> + int ready = 0;
> + if ((n->mask & X_NOTIFY_READ) && FD_ISSET(n->fd, &LastSelectMask))
> + ready |= X_NOTIFY_READ;
> + if ((n->mask & X_NOTIFY_WRITE) & FD_ISSET(n->fd, &LastSelectWriteMask))
> + ready |= X_NOTIFY_WRITE;
> + if (ready != 0)
> + n->notify(n->fd, ready, n->data);
> }
> }
ISTR the server currently has a "write then read" strategy for deadlock
avoidance (and accidentally better reliability when low on memory). Do
we want to do that here too, and if we do, do we split this into
walking the list twice to enforce the order, in case a caller has both
flags set?
- ajax
More information about the xorg-devel
mailing list