Interface

GioPollableInputStream

Description [src]

interface Gio.PollableInputStream : Gio.InputStream

GPollableInputStream is implemented by GInputStreams that can be polled for readiness to read. This can be used when interfacing with a non-GIO API that expects UNIX-file-descriptor-style asynchronous I/O rather than GIO-style.

Available since:2.28

Prerequisite

In order to implement PollableInputStream, your type must inherit from GInputStream.

Instance methods

g_pollable_input_stream_can_poll

Checks if stream is actually pollable. Some classes may implement GPollableInputStream but have only certain instances of that class be pollable. If this method returns FALSE, then the behavior of other GPollableInputStream methods is undefined.

Available since: 2.28

g_pollable_input_stream_create_source

Creates a GSource that triggers when stream can be read, or cancellable is triggered or an error occurs. The callback on the source is of the GPollableSourceFunc type.

Available since: 2.28

g_pollable_input_stream_is_readable

Checks if stream can be read.

Available since: 2.28

g_pollable_input_stream_read_nonblocking

Attempts to read up to count bytes from stream into buffer, as with g_input_stream_read(). If stream is not currently readable, this will immediately return G_IO_ERROR_WOULD_BLOCK, and you can use g_pollable_input_stream_create_source() to create a GSource that will be triggered when stream is readable.

Interface structure

struct GioPollableInputStreamInterface {
  GTypeInterface g_iface;
  gboolean (* can_poll) (
    GPollableInputStream* stream
  );
  gboolean (* is_readable) (
    GPollableInputStream* stream
  );
  GSource* (* create_source) (
    GPollableInputStream* stream,
    GCancellable* cancellable
  );
  gssize (* read_nonblocking) (
    GPollableInputStream* stream,
    void* buffer,
    gsize count,
    GError** error
  );
  
}
Interface members
g_iface
GTypeInterface
 

The parent interface.

can_poll
gboolean (* can_poll) (
    GPollableInputStream* stream
  )
 No description available.
is_readable
gboolean (* is_readable) (
    GPollableInputStream* stream
  )
 No description available.
create_source
GSource* (* create_source) (
    GPollableInputStream* stream,
    GCancellable* cancellable
  )
 No description available.
read_nonblocking
gssize (* read_nonblocking) (
    GPollableInputStream* stream,
    void* buffer,
    gsize count,
    GError** error
  )
 No description available.

Virtual methods

Gio.PollableInputStream.can_poll

Checks if stream is actually pollable. Some classes may implement GPollableInputStream but have only certain instances of that class be pollable. If this method returns FALSE, then the behavior of other GPollableInputStream methods is undefined.

Gio.PollableInputStream.create_source

Creates a GSource that triggers when stream can be read, or cancellable is triggered or an error occurs. The callback on the source is of the GPollableSourceFunc type.

Gio.PollableInputStream.is_readable

Checks if stream can be read.

Gio.PollableInputStream.read_nonblocking

Attempts to read up to count bytes from stream into buffer, as with g_input_stream_read(). If stream is not currently readable, this will immediately return G_IO_ERROR_WOULD_BLOCK, and you can use g_pollable_input_stream_create_source() to create a GSource that will be triggered when stream is readable.