InfStandaloneIo: libinfinity-0.7 Reference Manual

## InfStandaloneIo InfStandaloneIo — Simple event loop implementation |

## Stability Level

Unstable, unless otherwise indicated

## Functions

InfStandaloneIo * | inf_standalone_io_new ()
void | inf_standalone_io_iteration ()
void | inf_standalone_io_iteration_timeout ()
void | inf_standalone_io_loop ()
void | inf_standalone_io_loop_quit ()
gboolean | inf_standalone_io_loop_running ()

## Types and Values

struct | InfStandaloneIo
struct | InfStandaloneIoClass

## Object Hierarchy

        GObject
        ╰── InfStandaloneIo

## Implemented Interfaces

InfStandaloneIo implements InfIo.

## Includes

    #include <libinfinity/common/inf-standalone-io.h>

## Description

InfStandaloneIo is a simple implementation of the InfIo interface. It implements a basic application event loop with support for listening on sockets, scheduling timeouts and inter-thread notifications. The class is fully thread-safe.

This class can be perfectly used for all functions in libinfinity that require a InfIo object to wait for events. If, on top of that more functionality is required, or the main loop needs to be integrated with another library such as a UI toolkit, a custom class should be created instead which implements the InfIo interface. For the GTK+ toolkit, there is InfGtkIo in the libinfgtk library, to integrate with the Glib main loop.

## Functions

### inf_standalone_io_new ()

    InfStandaloneIo *
    inf_standalone_io_new (void);

Creates a new InfStandaloneIo.

[constructor]

#### Returns

A new InfStandaloneIo. Free with `g_object_unref()` when no longer needed.

[transfer full]

### inf_standalone_io_iteration ()

    void
    inf_standalone_io_iteration (InfStandaloneIo *io);

Performs a single iteration of `io` . The call will block until a first event has occurred. Then, it will process that event and return.

#### Parameters

io | A InfStandaloneIo. |

### inf_standalone_io_iteration_timeout ()

    void
    inf_standalone_io_iteration_timeout (InfStandaloneIo *io,
                                         guint timeout);

Performs a single iteration of `io` . The call will block until either an event occurred or `timeout` milliseconds have elapsed. If an event occurred, the event will be processed before returning.

#### Parameters

io | A InfStandaloneIo. |
timeout | Maximum number of milliseconds to block. |

### inf_standalone_io_loop ()

    void
    inf_standalone_io_loop (InfStandaloneIo *io);

This call will cause `io` to wait for events and process them, but not return until `inf_standalone_io_loop_quit()` is called.

#### Parameters

io | A InfStandaloneIo. |

### inf_standalone_io_loop_quit ()

    void
    inf_standalone_io_loop_quit (InfStandaloneIo *io);

Exits a loop in which `io` is running through a call to `inf_standalone_io_loop()`.

#### Parameters

io | A InfStandaloneIo. |

### inf_standalone_io_loop_running ()

    gboolean
    inf_standalone_io_loop_running (InfStandaloneIo *io);

Returns whether `io` runs currently in a loop initiated with `inf_standalone_io_loop()`.

#### Parameters

io | A InfStandaloneIo. |

#### Returns

Whether `io` runs in a loop.

## Types and Values

### struct InfStandaloneIo

    struct InfStandaloneIo;

InfStandaloneIo is an opaque data type. You should only access it via the public API functions.

### struct InfStandaloneIoClass

    struct InfStandaloneIoClass {
    };

This structure does not contain any public fields.

## See Also

InfIo