After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 677770 - GUnixOutputStream does not implement can_poll
GUnixOutputStream does not implement can_poll
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gio
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2012-06-09 18:25 UTC by David Zeuthen (not reading bugmail)
Modified: 2012-06-20 14:16 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description David Zeuthen (not reading bugmail) 2012-06-09 18:25:20 UTC
Because of this,  GPollableOutputStream.can_poll() always return TRUE, even for FDs from regular files.

This is problematic because it means that GOutputStream.write_async() will block the calling thread if the underlying fd is not pollable at all. Things still work, it's just that your calling thread is blocked even when you are using the async function.

Curiously enough, GUnixInputStream does not suffer from this problem (it implements can_poll just fine).
Comment 1 Dan Winship 2012-06-12 11:09:28 UTC
fixed. thanks
Comment 2 David Zeuthen (not reading bugmail) 2012-06-12 13:37:09 UTC
Thanks for fixing it.

I wonder if we should have tests for all the known GInputStream and GOutputStream implementations to check that they do the right thing, e.g. that read_async() and write_async() doesn't block the calling thread.

(The side-effect that made me find this bug was that the GUI main-loop was blocked and the idle scheduled by calling gtk_widget_queue_draw() wasn't calling until after the IO was done (I later switched my code to just using blocking read(2) and write(2) on the fd in a thread)... so, yeah, this is indeed possible to test.)
Comment 3 Dan Winship 2012-06-20 14:16:11 UTC
I added some can_poll() assertions to tests/pollable