Add pollable input/output streams

When interfacing with APIs that expect unix-style async I/O, it is
useful to be able to tell in advance whether a read/write is going to
block. This adds new interfaces GPollableInputStream and
GPollableOutputStream that can be implemented by a GInputStream or
GOutputStream to add _is_readable/_is_writable, _create_source, and
_read_nonblocking/_write_nonblocking methods.

Also, implement for GUnixInput/OutputStream and
GSocketInput/OutputStream

https://bugzilla.gnome.org/show_bug.cgi?id=634241
This commit is contained in:
Dan Winship
2010-09-18 13:05:25 -04:00
parent 6181c7de36
commit c20c2c0abd
19 changed files with 1251 additions and 12 deletions

View File

@@ -68,6 +68,8 @@
<xi:include href="xml/gunixoutputstream.xml"/>
<xi:include href="xml/gconverterinputstream.xml"/>
<xi:include href="xml/gconverteroutputstream.xml"/>
<xi:include href="xml/gpollableinputstream.xml"/>
<xi:include href="xml/gpollableoutputstream.xml"/>
</chapter>
<chapter id="types">
<title>File types and applications</title>

View File

@@ -2934,3 +2934,44 @@ G_IS_PERIODIC
<SUBSECTION Private>
g_periodic_get_type
</SECTION>
<SECTION>
<FILE>gpollableinputstream</FILE>
<TITLE>GPollableInputStream</TITLE>
GPollableInputStream
GPollableInputStreamInterface
<SUBSECTION>
g_pollable_input_stream_can_poll
g_pollable_input_stream_is_readable
g_pollable_input_stream_create_source
g_pollable_input_stream_read_nonblocking
<SUBSECTION>
GPollableSourceFunc
g_pollable_source_new
<SUBSECTION Standard>
G_POLLABLE_INPUT_STREAM
G_POLLABLE_INPUT_STREAM_GET_INTERFACE
G_IS_POLLABLE_INPUT_STREAM
G_TYPE_POLLABLE_INPUT_STREAM
<SUBSECTION Private>
g_pollable_input_stream_get_type
</SECTION>
<SECTION>
<FILE>gpollableoutputstream</FILE>
<TITLE>GPollableOutputStream</TITLE>
GPollableOutputStream
GPollableOutputStreamInterface
<SUBSECTION>
g_pollable_output_stream_can_poll
g_pollable_output_stream_is_writable
g_pollable_output_stream_create_source
g_pollable_output_stream_write_nonblocking
<SUBSECTION Standard>
G_POLLABLE_OUTPUT_STREAM
G_POLLABLE_OUTPUT_STREAM_GET_INTERFACE
G_IS_POLLABLE_OUTPUT_STREAM
G_TYPE_POLLABLE_OUTPUT_STREAM
<SUBSECTION Private>
g_pollable_output_stream_get_type
</SECTION>

View File

@@ -76,6 +76,9 @@ g_output_stream_splice_flags_get_type
g_password_save_get_type
g_periodic_get_type
g_permission_get_type
g_pollable_input_stream_get_type
g_pollable_io_stream_get_type
g_pollable_output_stream_get_type
g_proxy_address_enumerator_get_type
g_proxy_address_get_type
g_proxy_get_type