![]() |
![]() |
![]() |
libinfinity-0.6 Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Implemented Interfaces |
#include <libinfinity/common/inf-standalone-io.h> InfStandaloneIo; struct InfStandaloneIoClass; InfStandaloneIo * inf_standalone_io_new (void
); void inf_standalone_io_iteration (InfStandaloneIo *io
); void inf_standalone_io_iteration_timeout (InfStandaloneIo *io
,guint timeout
); void inf_standalone_io_loop (InfStandaloneIo *io
); void inf_standalone_io_loop_quit (InfStandaloneIo *io
); gboolean inf_standalone_io_loop_running (InfStandaloneIo *io
);
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.
typedef struct _InfStandaloneIo InfStandaloneIo;
InfStandaloneIo is an opaque data type. You should only access it via the public API functions.
struct InfStandaloneIoClass { };
This structure does not contain any public fields.
InfStandaloneIo * inf_standalone_io_new (void
);
Creates a new InfStandaloneIo.
Returns : |
A new InfStandaloneIo. Free with g_object_unref() when no longer
needed. |
void inf_standalone_io_iteration (InfStandaloneIo *io
);
Performs a single iteration of io
. The call will block until a first
event has occured. Then, it will process that event and return.
|
A InfStandaloneIo. |
void inf_standalone_io_iteration_timeout (InfStandaloneIo *io
,guint timeout
);
Performs a single iteration of io
. The call will block until either an
event occured or timeout
milliseconds have elapsed. If an event occured,
the event will be processed before returning.
|
A InfStandaloneIo. |
|
Maximum number of milliseconds to block. |
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.
|
A InfStandaloneIo. |
void inf_standalone_io_loop_quit (InfStandaloneIo *io
);
Exits a loop in which io
is running through a call to
inf_standalone_io_loop()
.
|
A InfStandaloneIo. |
gboolean inf_standalone_io_loop_running (InfStandaloneIo *io
);
Returns whether io
runs currently in a loop initiated with
inf_standalone_io_loop()
.
|
A InfStandaloneIo. |
Returns : |
Whether io runs in a loop. |