bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#21313: 25.0.50; Strange errors from dbus-handle-event


From: Tassilo Horn
Subject: bug#21313: 25.0.50; Strange errors from dbus-handle-event
Date: Tue, 22 Sep 2015 10:21:11 +0200
User-agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.0.50 (gnu/linux)

Robert Pluim <rpluim@gmail.com> writes:

>>>> --8<---------------cut here---------------start------------->8---
>>>> diff --git a/src/process.c b/src/process.c
>>>> index ed5f4c0..7985e37 100644
>>>> --- a/src/process.c
>>>> +++ b/src/process.c
>>>> @@ -5036,7 +5036,10 @@ wait_reading_process_output (intmax_t time_limit, 
>>>> int nsecs, int read_kbd,
>>>>               && FD_ISSET (channel, &Available))
>>>>              || (d->condition & FOR_WRITE
>>>>                  && FD_ISSET (channel, &write_mask))))
>>>> -            d->func (channel, d->data);
>>>> +      {
>>>> +        d->func (channel, d->data);
>>>> +        FD_CLR (channel, &Available);
>>>> +      }
>>>>    }
>>>>  
>>>>        for (channel = 0; channel <= max_process_desc; channel++)
>>>> --8<---------------cut here---------------end--------------->8---
>
> What if it was the 'FOR_WRITE' part of the condition that triggered?
> Perhaps we should split the 'if'.

I think in this case, channel cannot be in Available so by handling this
case we could only save one needless operation.  But that might be
reason enough, so I committed the following patch.

--8<---------------cut here---------------start------------->8---
1 file changed, 10 insertions(+), 7 deletions(-)
src/process.c | 17 ++++++++++-------

modified   src/process.c
@@ -5031,14 +5031,17 @@ wait_reading_process_output (intmax_t time_limit, int 
nsecs, int read_kbd,
       for (channel = 0; channel <= max_input_desc; ++channel)
         {
           struct fd_callback_data *d = &fd_callback_info[channel];
-          if (d->func
-             && ((d->condition & FOR_READ
-                  && FD_ISSET (channel, &Available))
-                 || (d->condition & FOR_WRITE
-                     && FD_ISSET (channel, &write_mask))))
+          if (d->func)
            {
-             d->func (channel, d->data);
-             FD_CLR (channel, &Available);
+             if (d->condition & FOR_READ
+                 && FD_ISSET (channel, &Available))
+               {
+                 d->func (channel, d->data);
+                 FD_CLR (channel, &Available);
+               }
+             else if (d->condition & FOR_WRITE
+                      && FD_ISSET (channel, &write_mask))
+               d->func (channel, d->data);
            }
        }
--8<---------------cut here---------------end--------------->8---

Bye,
Tassilo





reply via email to

[Prev in Thread] Current Thread [Next in Thread]