gio: minor GPollableInputStream / GPollableOutputStream fixes

Make g_pollable_input_stream_read() and
g_pollable_output_stream_write() look a little bit more like the
non-pollable versions in terms of error handling, etc. Also, use the
read_fn and write_fn virtual methods directly rather than calling
g_input_stream_read()/g_output_stream_write(), to avoid problems with
re-entrancy involving the "pending" flag.

Also belatedly add single-include guards to the header files.

https://bugzilla.gnome.org/show_bug.cgi?id=673997
This commit is contained in:
Dan Winship
2012-04-01 14:47:19 -04:00
parent adea9fb252
commit 7e95777a6a
4 changed files with 74 additions and 24 deletions

View File

@@ -18,6 +18,10 @@
* Boston, MA 02111-1307, USA.
*/
#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
#error "Only <gio/gio.h> can be included directly."
#endif
#ifndef __G_POLLABLE_OUTPUT_STREAM_H__
#define __G_POLLABLE_OUTPUT_STREAM_H__
@@ -73,7 +77,7 @@ struct _GPollableOutputStreamInterface
GCancellable *cancellable);
gssize (*write_nonblocking) (GPollableOutputStream *stream,
const void *buffer,
gsize size,
gsize count,
GError **error);
};
@@ -87,7 +91,7 @@ GSource *g_pollable_output_stream_create_source (GPollableOutputStream *str
gssize g_pollable_output_stream_write_nonblocking (GPollableOutputStream *stream,
const void *buffer,
gsize size,
gsize count,
GCancellable *cancellable,
GError **error);