* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __G_MAIN_H__
/**
* GMainContext:
*
- * The <structname>GMainContext</structname> struct is an opaque data
+ * The `GMainContext` struct is an opaque data
* type representing a set of sources to be handled in a main loop.
*/
typedef struct _GMainContext GMainContext;
/**
* GMainLoop:
*
- * The <structname>GMainLoop</structname> struct is an opaque data type
+ * The `GMainLoop` struct is an opaque data type
* representing the main event loop of a GLib or GTK+ application.
*/
typedef struct _GMainLoop GMainLoop;
/**
* GSource:
*
- * The <structname>GSource</structname> struct is an opaque data type
+ * The `GSource` struct is an opaque data type
* representing an event source.
*/
typedef struct _GSource GSource;
* @get: Called to extract the callback function and data from the
* callback object.
- * The <structname>GSourceCallbackFuncs</structname> struct contains
+ * The `GSourceCallbackFuncs` struct contains
* functions for managing callback objects.
*/
typedef struct _GSourceCallbackFuncs GSourceCallbackFuncs;
* results of the poll() call) it should return %TRUE. It can also return
* a @timeout_ value which should be the maximum timeout (in milliseconds)
* which should be passed to the poll() call. The actual timeout used will
- * be -1 if all sources returned -1, or it will be the minimum of all the
- * @timeout_ values returned which were >= 0.
+ * be -1 if all sources returned -1, or it will be the minimum of all
+ * the @timeout_ values returned which were >= 0. Since 2.36 this may
+ * be %NULL, in which case the effect is as if the function always returns
+ * %FALSE with a timeout of -1. If @prepare returns a
+ * timeout and the source also has a 'ready time' set then the
+ * nearer of the two will be used.
* @check: Called after all the file descriptors are polled. The source
* should return %TRUE if it is ready to be dispatched. Note that some
* time may have passed since the previous prepare function was called,
- * so the source should be checked again here.
+ * so the source should be checked again here. Since 2.36 this may
+ * be %NULL, in which case the effect is as if the function always returns
+ * %FALSE.
* @dispatch: Called to dispatch the event source, after it has returned
* %TRUE in either its @prepare or its @check function. The @dispatch
* function is passed in a callback function and data. The callback
* are needed for this type of event source.
* @finalize: Called when the source is finalized.
*
- * The <structname>GSourceFuncs</structname> struct contains a table of
+ * The `GSourceFuncs` struct contains a table of
* functions used to handle event sources in a generic manner.
*
* For idle sources, the prepare and check functions always return %TRUE
* Specifies the type of function passed to g_timeout_add(),
* g_timeout_add_full(), g_idle_add(), and g_idle_add_full().
*
- * Returns: %FALSE if the source should be removed
+ * Returns: %FALSE if the source should be removed. #G_SOURCE_CONTINUE and
+ * #G_SOURCE_REMOVE are more memorable names for the return value.
*/
typedef gboolean (*GSourceFunc) (gpointer user_data);
void g_source_set_name_by_id (guint tag,
const char *name);
+GLIB_AVAILABLE_IN_2_36
+void g_source_set_ready_time (GSource *source,
+ gint64 ready_time);
+GLIB_AVAILABLE_IN_2_36
+gint64 g_source_get_ready_time (GSource *source);
+
+#ifdef G_OS_UNIX
+GLIB_AVAILABLE_IN_2_36
+gpointer g_source_add_unix_fd (GSource *source,
+ gint fd,
+ GIOCondition events);
+GLIB_AVAILABLE_IN_2_36
+void g_source_modify_unix_fd (GSource *source,
+ gpointer tag,
+ GIOCondition new_events);
+GLIB_AVAILABLE_IN_2_36
+void g_source_remove_unix_fd (GSource *source,
+ gpointer tag);
+GLIB_AVAILABLE_IN_2_36
+GIOCondition g_source_query_unix_fd (GSource *source,
+ gpointer tag);
+#endif
/* Used to implement g_source_connect_closure and internally*/
GLIB_AVAILABLE_IN_ALL
GLIB_VAR GSourceFuncs g_timeout_funcs;
GLIB_VAR GSourceFuncs g_child_watch_funcs;
GLIB_VAR GSourceFuncs g_idle_funcs;
+#ifdef G_OS_UNIX
+GLIB_VAR GSourceFuncs g_unix_signal_funcs;
+GLIB_VAR GSourceFuncs g_unix_fd_source_funcs;
+#endif
G_END_DECLS