/** * inf_io_remove_timeout: * @io: A #InfIo. * @timeout: A timeout handle obtained from inf_io_add_timeout(). * * Removes the given timeout. **/ void inf_io_remove_timeout(InfIo* io, InfIoTimeout* timeout) { InfIoIface* iface; g_return_if_fail(INF_IS_IO(io)); g_return_if_fail(timeout != NULL); iface = INF_IO_GET_IFACE(io); g_return_if_fail(iface->remove_timeout != NULL); iface->remove_timeout(io, timeout); }
/** * inf_io_remove_dispatch: * @io: A #InfIo. * @dispatch: A dispatch handle obtained from inf_io_add_dispatch(). * * Removes the given dispatch from @io so that it is not called. **/ void inf_io_remove_dispatch(InfIo* io, InfIoDispatch* dispatch) { InfIoIface* iface; g_return_if_fail(INF_IS_IO(io)); g_return_if_fail(dispatch != NULL); iface = INF_IO_GET_IFACE(io); g_return_if_fail(iface->remove_dispatch != NULL); iface->remove_dispatch(io, dispatch); }
/** * inf_io_update_watch: * @io: A #InfIo. * @watch: The watch to update, as returned by inf_io_add_watch(). * @events: The new events to watch for. * * Changes the events that the socket bound to @watch is being watched for. * The callback of @watch will only be called if one of the newly watched for * events occurs. */ void inf_io_update_watch(InfIo* io, InfIoWatch* watch, InfIoEvent events) { InfIoIface* iface; g_return_if_fail(INF_IS_IO(io)); g_return_if_fail(watch != NULL); iface = INF_IO_GET_IFACE(io); g_return_if_fail(iface->update_watch != NULL); iface->update_watch(io, watch, events); }
/** * inf_io_add_dispatch: * @io: A #InfIo. * @func: Function to be called when the function is dispatched. * @user_data: Extra data to pass to @func. * @notify: A #GDestroyNotify that is called when @user_data is no longer * needed, or %NULL. * * Schedules @func to be called by the thread @io runs in. This function can * be used from a different thread to communicate to @io's thread. * * Returns: A dispatch handle that can be used to stop the dispatched function * from being called as long as it has not yet been called. **/ InfIoDispatch* inf_io_add_dispatch(InfIo* io, InfIoDispatchFunc func, gpointer user_data, GDestroyNotify notify) { InfIoIface* iface; g_return_val_if_fail(INF_IS_IO(io), NULL); g_return_val_if_fail(func != NULL, NULL); iface = INF_IO_GET_IFACE(io); g_return_val_if_fail(iface->add_dispatch != NULL, NULL); return iface->add_dispatch(io, func, user_data, notify); }
/** * inf_io_add_timeout: * @io: A #InfIo. * @msecs: Number of milliseconds after which the timeout should be elapsed. * @func: Function to be called when the timeout elapsed. * @user_data: Extra data to pass to @func. * @notify: A #GDestroyNotify that is called when @user_data is no longer * needed, or %NULL. * * Calls @func after at least @msecs milliseconds have elapsed. The timeout * is removed after it has elapsed. * * Returns: A timeout handle that can be used to remove the timeout. **/ InfIoTimeout* inf_io_add_timeout(InfIo* io, guint msecs, InfIoTimeoutFunc func, gpointer user_data, GDestroyNotify notify) { InfIoIface* iface; g_return_val_if_fail(INF_IS_IO(io), NULL); g_return_val_if_fail(func != NULL, NULL); iface = INF_IO_GET_IFACE(io); g_return_val_if_fail(iface->add_timeout != NULL, NULL); return iface->add_timeout(io, msecs, func, user_data, notify); }
/** * inf_io_add_watch: * @io: A #InfIo. * @socket: The socket to watch. * @events: Events to watch for. * @func: Function to be called when one of the events occurs. * @user_data: Extra data to pass to @func. * @notify: A #GDestroyNotify that is called when @user_data is no longer * needed, or %NULL. * * Monitors the given socket for activity and calls @func if one of the * events specified in @events occurs. * * Returns: A #InfIoWatch that can be used to update or remove the watch. **/ InfIoWatch* inf_io_add_watch(InfIo* io, InfNativeSocket* socket, InfIoEvent events, InfIoWatchFunc func, gpointer user_data, GDestroyNotify notify) { InfIoIface* iface; g_return_val_if_fail(INF_IS_IO(io), NULL); g_return_val_if_fail(socket != NULL, NULL); g_return_val_if_fail(func != NULL, NULL); iface = INF_IO_GET_IFACE(io); g_return_val_if_fail(iface->add_watch != NULL, NULL); return iface->add_watch(io, socket, events, func, user_data, notify); }
/** * inf_io_watch: * @io: A #InfIo. * @socket: The socket to watch. * @events: Events to watch for. * @func: Function to be called when one of the events occurs. * @user_data: Extra data to pass to @func. * @notify: A #GDestroyNotify that is called when @user_data is no longer * needed, or %NULL. * * Monitors the given socket for activity and calls @func if one of the * events specified in @events occurs. **/ void inf_io_watch(InfIo* io, InfNativeSocket* socket, InfIoEvent events, InfIoFunc func, gpointer user_data, GDestroyNotify notify) { InfIoIface* iface; g_return_if_fail(INF_IS_IO(io)); g_return_if_fail(socket != NULL); g_return_if_fail(events == 0 || func != NULL); iface = INF_IO_GET_IFACE(io); g_return_if_fail(iface->watch != NULL); iface->watch(io, socket, events, func, user_data, notify); }