[Github-comments] [geany/geany] Handle continuous G_IO_IN-s without any data (#1461)

zhekov notifications at xxxxx
Fri Apr 21 18:00:54 UTC 2017


zhekov commented on this pull request.



> @@ -967,6 +999,23 @@ static gboolean spawn_read_cb(GIOChannel *channel, GIOCondition condition, gpoin
 
 		sc->cb.read(buffer, input_cond | failure_cond, sc->cb_data);
 	}
+	/* Check for continuous activations with G_IO_IN | G_IO_PRI, without any
+	   data to read and without errors. If detected, switch to timeout source. */
+	else if (sc->empty_gio_ins < MAX_EMPTY_GIO_INS && status == G_IO_STATUS_AGAIN)

"status" can be different from G_IO_STATUS_NORMAL only if we attempted to read. This means a (G_IO_IN | G_IO_PRI) condition, possibly combined with G_IO_FAILURE condition. We filter out the failures in the "if" clause, so a G_IO_STATUS_AGAIN means only (G_IO_IN | G_IO_PRI) condition at this point. But if there is no failure, spawn_read_cb() reads only once, for reasons explained in the source, and thus AGAIN is not a result of a subsequent read.

In summary, we received a G_IO_IN | G_IO_PRI, attempted to read, and immediately got G_IO_STATUS_AGAIN, which shoudn't happen...

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/1461#discussion_r112745174
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20170421/103f98b9/attachment.html>


More information about the Github-comments mailing list