On Wed, 8 Jun 2011 20:14:01 +0100 Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> wrote: > Otherwise drmHandleEvent will block if accidentally read too often... > > Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> > Cc: Phillip Haddad <phillip.haddad@xxxxxxxxx> > --- > drivers/gpu/drm/drm_fops.c | 3 +++ > 1 files changed, 3 insertions(+), 0 deletions(-) > > diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c > index 2ec7d48..279aa95 100644 > --- a/drivers/gpu/drm/drm_fops.c > +++ b/drivers/gpu/drm/drm_fops.c > @@ -617,6 +617,9 @@ ssize_t drm_read(struct file *filp, char __user *buffer, > size_t total; > ssize_t ret; > > + if (filp->f_flags & O_NONBLOCK && list_empty(&file_priv->event_list)) > + return -EAGAIN; > + > ret = wait_event_interruptible(file_priv->event_wait, > !list_empty(&file_priv->event_list)); > if (ret < 0) What happens if someone else empties the list between the test and the wait_event_interruptible ? _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/dri-devel