1/* gmain.h - the GLib Main loop
2 * Copyright (C) 1998-2000 Red Hat, Inc.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this library; if not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef __G_MAIN_H__
19#define __G_MAIN_H__
20
21#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
22#error "Only <glib.h> can be included directly."
23#endif
24
25#include <glib/gpoll.h>
26#include <glib/gslist.h>
27#include <glib/gthread.h>
28
29G_BEGIN_DECLS
30
31typedef enum /*< flags >*/
32{
33 G_IO_IN GLIB_SYSDEF_POLLIN,
34 G_IO_OUT GLIB_SYSDEF_POLLOUT,
35 G_IO_PRI GLIB_SYSDEF_POLLPRI,
36 G_IO_ERR GLIB_SYSDEF_POLLERR,
37 G_IO_HUP GLIB_SYSDEF_POLLHUP,
38 G_IO_NVAL GLIB_SYSDEF_POLLNVAL
39} GIOCondition;
40
41
42/**
43 * GMainContext:
44 *
45 * The `GMainContext` struct is an opaque data
46 * type representing a set of sources to be handled in a main loop.
47 */
48typedef struct _GMainContext GMainContext;
49
50/**
51 * GMainLoop:
52 *
53 * The `GMainLoop` struct is an opaque data type
54 * representing the main event loop of a GLib or GTK+ application.
55 */
56typedef struct _GMainLoop GMainLoop;
57
58/**
59 * GSource:
60 *
61 * The `GSource` struct is an opaque data type
62 * representing an event source.
63 */
64typedef struct _GSource GSource;
65typedef struct _GSourcePrivate GSourcePrivate;
66
67/**
68 * GSourceCallbackFuncs:
69 * @ref: Called when a reference is added to the callback object
70 * @unref: Called when a reference to the callback object is dropped
71 * @get: Called to extract the callback function and data from the
72 * callback object.
73 *
74 * The `GSourceCallbackFuncs` struct contains
75 * functions for managing callback objects.
76 */
77typedef struct _GSourceCallbackFuncs GSourceCallbackFuncs;
78
79/**
80 * GSourceFuncs:
81 * @prepare: Called before all the file descriptors are polled. If the
82 * source can determine that it is ready here (without waiting for the
83 * results of the poll() call) it should return %TRUE. It can also return
84 * a @timeout_ value which should be the maximum timeout (in milliseconds)
85 * which should be passed to the poll() call. The actual timeout used will
86 * be -1 if all sources returned -1, or it will be the minimum of all
87 * the @timeout_ values returned which were >= 0. Since 2.36 this may
88 * be %NULL, in which case the effect is as if the function always returns
89 * %FALSE with a timeout of -1. If @prepare returns a
90 * timeout and the source also has a ready time set, then the
91 * lower of the two will be used.
92 * @check: Called after all the file descriptors are polled. The source
93 * should return %TRUE if it is ready to be dispatched. Note that some
94 * time may have passed since the previous prepare function was called,
95 * so the source should be checked again here. Since 2.36 this may
96 * be %NULL, in which case the effect is as if the function always returns
97 * %FALSE.
98 * @dispatch: Called to dispatch the event source, after it has returned
99 * %TRUE in either its @prepare or its @check function, or if a ready time
100 * has been reached. The @dispatch function receives a callback function and
101 * user data. The callback function may be %NULL if the source was never
102 * connected to a callback using g_source_set_callback(). The @dispatch
103 * function should call the callback function with @user_data and whatever
104 * additional parameters are needed for this type of event source. The
105 * return value of the @dispatch function should be #G_SOURCE_REMOVE if the
106 * source should be removed or #G_SOURCE_CONTINUE to keep it.
107 * @finalize: Called when the source is finalized. At this point, the source
108 * will have been destroyed, had its callback cleared, and have been removed
109 * from its #GMainContext, but it will still have its final reference count,
110 * so methods can be called on it from within this function.
111 *
112 * The `GSourceFuncs` struct contains a table of
113 * functions used to handle event sources in a generic manner.
114 *
115 * For idle sources, the prepare and check functions always return %TRUE
116 * to indicate that the source is always ready to be processed. The prepare
117 * function also returns a timeout value of 0 to ensure that the poll() call
118 * doesn't block (since that would be time wasted which could have been spent
119 * running the idle function).
120 *
121 * For timeout sources, the prepare and check functions both return %TRUE
122 * if the timeout interval has expired. The prepare function also returns
123 * a timeout value to ensure that the poll() call doesn't block too long
124 * and miss the next timeout.
125 *
126 * For file descriptor sources, the prepare function typically returns %FALSE,
127 * since it must wait until poll() has been called before it knows whether
128 * any events need to be processed. It sets the returned timeout to -1 to
129 * indicate that it doesn't mind how long the poll() call blocks. In the
130 * check function, it tests the results of the poll() call to see if the
131 * required condition has been met, and returns %TRUE if so.
132 */
133typedef struct _GSourceFuncs GSourceFuncs;
134
135/**
136 * GPid:
137 *
138 * A type which is used to hold a process identification.
139 *
140 * On UNIX, processes are identified by a process id (an integer),
141 * while Windows uses process handles (which are pointers).
142 *
143 * GPid is used in GLib only for descendant processes spawned with
144 * the g_spawn functions.
145 */
146/* defined in glibconfig.h */
147
148/**
149 * G_PID_FORMAT:
150 *
151 * A format specifier that can be used in printf()-style format strings
152 * when printing a #GPid.
153 *
154 * Since: 2.50
155 */
156/* defined in glibconfig.h */
157
158/**
159 * GSourceFunc:
160 * @user_data: data passed to the function, set when the source was
161 * created with one of the above functions
162 *
163 * Specifies the type of function passed to g_timeout_add(),
164 * g_timeout_add_full(), g_idle_add(), and g_idle_add_full().
165 *
166 * When calling g_source_set_callback(), you may need to cast a function of a
167 * different type to this type. Use G_SOURCE_FUNC() to avoid warnings about
168 * incompatible function types.
169 *
170 * Returns: %FALSE if the source should be removed. #G_SOURCE_CONTINUE and
171 * #G_SOURCE_REMOVE are more memorable names for the return value.
172 */
173typedef gboolean (*GSourceFunc) (gpointer user_data);
174
175/**
176 * G_SOURCE_FUNC:
177 * @f: a function pointer.
178 *
179 * Cast a function pointer to a #GSourceFunc, suppressing warnings from GCC 8
180 * onwards with `-Wextra` or `-Wcast-function-type` enabled about the function
181 * types being incompatible.
182 *
183 * For example, the correct type of callback for a source created by
184 * g_child_watch_source_new() is #GChildWatchFunc, which accepts more arguments
185 * than #GSourceFunc. Casting the function with `(GSourceFunc)` to call
186 * g_source_set_callback() will trigger a warning, even though it will be cast
187 * back to the correct type before it is called by the source.
188 *
189 * Since: 2.58
190 */
191#define G_SOURCE_FUNC(f) ((GSourceFunc) (void (*)(void)) (f))
192
193/**
194 * GChildWatchFunc:
195 * @pid: the process id of the child process
196 * @status: Status information about the child process, encoded
197 * in a platform-specific manner
198 * @user_data: user data passed to g_child_watch_add()
199 *
200 * Prototype of a #GChildWatchSource callback, called when a child
201 * process has exited. To interpret @status, see the documentation
202 * for g_spawn_check_exit_status().
203 */
204typedef void (*GChildWatchFunc) (GPid pid,
205 gint status,
206 gpointer user_data);
207struct _GSource
208{
209 /*< private >*/
210 gpointer callback_data;
211 GSourceCallbackFuncs *callback_funcs;
212
213 const GSourceFuncs *source_funcs;
214 guint ref_count;
215
216 GMainContext *context;
217
218 gint priority;
219 guint flags;
220 guint source_id;
221
222 GSList *poll_fds;
223
224 GSource *prev;
225 GSource *next;
226
227 char *name;
228
229 GSourcePrivate *priv;
230};
231
232struct _GSourceCallbackFuncs
233{
234 void (*ref) (gpointer cb_data);
235 void (*unref) (gpointer cb_data);
236 void (*get) (gpointer cb_data,
237 GSource *source,
238 GSourceFunc *func,
239 gpointer *data);
240};
241
242/**
243 * GSourceDummyMarshal:
244 *
245 * This is just a placeholder for #GClosureMarshal,
246 * which cannot be used here for dependency reasons.
247 */
248typedef void (*GSourceDummyMarshal) (void);
249
250struct _GSourceFuncs
251{
252 gboolean (*prepare) (GSource *source,
253 gint *timeout_);
254 gboolean (*check) (GSource *source);
255 gboolean (*dispatch) (GSource *source,
256 GSourceFunc callback,
257 gpointer user_data);
258 void (*finalize) (GSource *source); /* Can be NULL */
259
260 /*< private >*/
261 /* For use by g_source_set_closure */
262 GSourceFunc closure_callback;
263 GSourceDummyMarshal closure_marshal; /* Really is of type GClosureMarshal */
264};
265
266/* Standard priorities */
267
268/**
269 * G_PRIORITY_HIGH:
270 *
271 * Use this for high priority event sources.
272 *
273 * It is not used within GLib or GTK+.
274 */
275#define G_PRIORITY_HIGH -100
276
277/**
278 * G_PRIORITY_DEFAULT:
279 *
280 * Use this for default priority event sources.
281 *
282 * In GLib this priority is used when adding timeout functions
283 * with g_timeout_add(). In GDK this priority is used for events
284 * from the X server.
285 */
286#define G_PRIORITY_DEFAULT 0
287
288/**
289 * G_PRIORITY_HIGH_IDLE:
290 *
291 * Use this for high priority idle functions.
292 *
293 * GTK+ uses #G_PRIORITY_HIGH_IDLE + 10 for resizing operations,
294 * and #G_PRIORITY_HIGH_IDLE + 20 for redrawing operations. (This is
295 * done to ensure that any pending resizes are processed before any
296 * pending redraws, so that widgets are not redrawn twice unnecessarily.)
297 */
298#define G_PRIORITY_HIGH_IDLE 100
299
300/**
301 * G_PRIORITY_DEFAULT_IDLE:
302 *
303 * Use this for default priority idle functions.
304 *
305 * In GLib this priority is used when adding idle functions with
306 * g_idle_add().
307 */
308#define G_PRIORITY_DEFAULT_IDLE 200
309
310/**
311 * G_PRIORITY_LOW:
312 *
313 * Use this for very low priority background tasks.
314 *
315 * It is not used within GLib or GTK+.
316 */
317#define G_PRIORITY_LOW 300
318
319/**
320 * G_SOURCE_REMOVE:
321 *
322 * Use this macro as the return value of a #GSourceFunc to remove
323 * the #GSource from the main loop.
324 *
325 * Since: 2.32
326 */
327#define G_SOURCE_REMOVE FALSE
328
329/**
330 * G_SOURCE_CONTINUE:
331 *
332 * Use this macro as the return value of a #GSourceFunc to leave
333 * the #GSource in the main loop.
334 *
335 * Since: 2.32
336 */
337#define G_SOURCE_CONTINUE TRUE
338
339/* GMainContext: */
340
341GLIB_AVAILABLE_IN_ALL
342GMainContext *g_main_context_new (void);
343GLIB_AVAILABLE_IN_ALL
344GMainContext *g_main_context_ref (GMainContext *context);
345GLIB_AVAILABLE_IN_ALL
346void g_main_context_unref (GMainContext *context);
347GLIB_AVAILABLE_IN_ALL
348GMainContext *g_main_context_default (void);
349
350GLIB_AVAILABLE_IN_ALL
351gboolean g_main_context_iteration (GMainContext *context,
352 gboolean may_block);
353GLIB_AVAILABLE_IN_ALL
354gboolean g_main_context_pending (GMainContext *context);
355
356/* For implementation of legacy interfaces
357 */
358GLIB_AVAILABLE_IN_ALL
359GSource *g_main_context_find_source_by_id (GMainContext *context,
360 guint source_id);
361GLIB_AVAILABLE_IN_ALL
362GSource *g_main_context_find_source_by_user_data (GMainContext *context,
363 gpointer user_data);
364GLIB_AVAILABLE_IN_ALL
365GSource *g_main_context_find_source_by_funcs_user_data (GMainContext *context,
366 GSourceFuncs *funcs,
367 gpointer user_data);
368
369/* Low level functions for implementing custom main loops.
370 */
371GLIB_AVAILABLE_IN_ALL
372void g_main_context_wakeup (GMainContext *context);
373GLIB_AVAILABLE_IN_ALL
374gboolean g_main_context_acquire (GMainContext *context);
375GLIB_AVAILABLE_IN_ALL
376void g_main_context_release (GMainContext *context);
377GLIB_AVAILABLE_IN_ALL
378gboolean g_main_context_is_owner (GMainContext *context);
379GLIB_DEPRECATED_IN_2_58_FOR(g_main_context_is_owner)
380gboolean g_main_context_wait (GMainContext *context,
381 GCond *cond,
382 GMutex *mutex);
383
384GLIB_AVAILABLE_IN_ALL
385gboolean g_main_context_prepare (GMainContext *context,
386 gint *priority);
387GLIB_AVAILABLE_IN_ALL
388gint g_main_context_query (GMainContext *context,
389 gint max_priority,
390 gint *timeout_,
391 GPollFD *fds,
392 gint n_fds);
393GLIB_AVAILABLE_IN_ALL
394gboolean g_main_context_check (GMainContext *context,
395 gint max_priority,
396 GPollFD *fds,
397 gint n_fds);
398GLIB_AVAILABLE_IN_ALL
399void g_main_context_dispatch (GMainContext *context);
400
401GLIB_AVAILABLE_IN_ALL
402void g_main_context_set_poll_func (GMainContext *context,
403 GPollFunc func);
404GLIB_AVAILABLE_IN_ALL
405GPollFunc g_main_context_get_poll_func (GMainContext *context);
406
407/* Low level functions for use by source implementations
408 */
409GLIB_AVAILABLE_IN_ALL
410void g_main_context_add_poll (GMainContext *context,
411 GPollFD *fd,
412 gint priority);
413GLIB_AVAILABLE_IN_ALL
414void g_main_context_remove_poll (GMainContext *context,
415 GPollFD *fd);
416
417GLIB_AVAILABLE_IN_ALL
418gint g_main_depth (void);
419GLIB_AVAILABLE_IN_ALL
420GSource *g_main_current_source (void);
421
422/* GMainContexts for other threads
423 */
424GLIB_AVAILABLE_IN_ALL
425void g_main_context_push_thread_default (GMainContext *context);
426GLIB_AVAILABLE_IN_ALL
427void g_main_context_pop_thread_default (GMainContext *context);
428GLIB_AVAILABLE_IN_ALL
429GMainContext *g_main_context_get_thread_default (void);
430GLIB_AVAILABLE_IN_ALL
431GMainContext *g_main_context_ref_thread_default (void);
432
433/* GMainLoop: */
434
435GLIB_AVAILABLE_IN_ALL
436GMainLoop *g_main_loop_new (GMainContext *context,
437 gboolean is_running);
438GLIB_AVAILABLE_IN_ALL
439void g_main_loop_run (GMainLoop *loop);
440GLIB_AVAILABLE_IN_ALL
441void g_main_loop_quit (GMainLoop *loop);
442GLIB_AVAILABLE_IN_ALL
443GMainLoop *g_main_loop_ref (GMainLoop *loop);
444GLIB_AVAILABLE_IN_ALL
445void g_main_loop_unref (GMainLoop *loop);
446GLIB_AVAILABLE_IN_ALL
447gboolean g_main_loop_is_running (GMainLoop *loop);
448GLIB_AVAILABLE_IN_ALL
449GMainContext *g_main_loop_get_context (GMainLoop *loop);
450
451/* GSource: */
452
453GLIB_AVAILABLE_IN_ALL
454GSource *g_source_new (GSourceFuncs *source_funcs,
455 guint struct_size);
456GLIB_AVAILABLE_IN_ALL
457GSource *g_source_ref (GSource *source);
458GLIB_AVAILABLE_IN_ALL
459void g_source_unref (GSource *source);
460
461GLIB_AVAILABLE_IN_ALL
462guint g_source_attach (GSource *source,
463 GMainContext *context);
464GLIB_AVAILABLE_IN_ALL
465void g_source_destroy (GSource *source);
466
467GLIB_AVAILABLE_IN_ALL
468void g_source_set_priority (GSource *source,
469 gint priority);
470GLIB_AVAILABLE_IN_ALL
471gint g_source_get_priority (GSource *source);
472GLIB_AVAILABLE_IN_ALL
473void g_source_set_can_recurse (GSource *source,
474 gboolean can_recurse);
475GLIB_AVAILABLE_IN_ALL
476gboolean g_source_get_can_recurse (GSource *source);
477GLIB_AVAILABLE_IN_ALL
478guint g_source_get_id (GSource *source);
479
480GLIB_AVAILABLE_IN_ALL
481GMainContext *g_source_get_context (GSource *source);
482
483GLIB_AVAILABLE_IN_ALL
484void g_source_set_callback (GSource *source,
485 GSourceFunc func,
486 gpointer data,
487 GDestroyNotify notify);
488
489GLIB_AVAILABLE_IN_ALL
490void g_source_set_funcs (GSource *source,
491 GSourceFuncs *funcs);
492GLIB_AVAILABLE_IN_ALL
493gboolean g_source_is_destroyed (GSource *source);
494
495GLIB_AVAILABLE_IN_ALL
496void g_source_set_name (GSource *source,
497 const char *name);
498GLIB_AVAILABLE_IN_ALL
499const char * g_source_get_name (GSource *source);
500GLIB_AVAILABLE_IN_ALL
501void g_source_set_name_by_id (guint tag,
502 const char *name);
503
504GLIB_AVAILABLE_IN_2_36
505void g_source_set_ready_time (GSource *source,
506 gint64 ready_time);
507GLIB_AVAILABLE_IN_2_36
508gint64 g_source_get_ready_time (GSource *source);
509
510#ifdef G_OS_UNIX
511GLIB_AVAILABLE_IN_2_36
512gpointer g_source_add_unix_fd (GSource *source,
513 gint fd,
514 GIOCondition events);
515GLIB_AVAILABLE_IN_2_36
516void g_source_modify_unix_fd (GSource *source,
517 gpointer tag,
518 GIOCondition new_events);
519GLIB_AVAILABLE_IN_2_36
520void g_source_remove_unix_fd (GSource *source,
521 gpointer tag);
522GLIB_AVAILABLE_IN_2_36
523GIOCondition g_source_query_unix_fd (GSource *source,
524 gpointer tag);
525#endif
526
527/* Used to implement g_source_connect_closure and internally*/
528GLIB_AVAILABLE_IN_ALL
529void g_source_set_callback_indirect (GSource *source,
530 gpointer callback_data,
531 GSourceCallbackFuncs *callback_funcs);
532
533GLIB_AVAILABLE_IN_ALL
534void g_source_add_poll (GSource *source,
535 GPollFD *fd);
536GLIB_AVAILABLE_IN_ALL
537void g_source_remove_poll (GSource *source,
538 GPollFD *fd);
539
540GLIB_AVAILABLE_IN_ALL
541void g_source_add_child_source (GSource *source,
542 GSource *child_source);
543GLIB_AVAILABLE_IN_ALL
544void g_source_remove_child_source (GSource *source,
545 GSource *child_source);
546
547G_GNUC_BEGIN_IGNORE_DEPRECATIONS
548GLIB_DEPRECATED_IN_2_28_FOR(g_source_get_time)
549void g_source_get_current_time (GSource *source,
550 GTimeVal *timeval);
551G_GNUC_END_IGNORE_DEPRECATIONS
552
553GLIB_AVAILABLE_IN_ALL
554gint64 g_source_get_time (GSource *source);
555
556 /* void g_source_connect_closure (GSource *source,
557 GClosure *closure);
558 */
559
560/* Specific source types
561 */
562GLIB_AVAILABLE_IN_ALL
563GSource *g_idle_source_new (void);
564GLIB_AVAILABLE_IN_ALL
565GSource *g_child_watch_source_new (GPid pid);
566GLIB_AVAILABLE_IN_ALL
567GSource *g_timeout_source_new (guint interval);
568GLIB_AVAILABLE_IN_ALL
569GSource *g_timeout_source_new_seconds (guint interval);
570
571/* Miscellaneous functions
572 */
573G_GNUC_BEGIN_IGNORE_DEPRECATIONS
574GLIB_DEPRECATED_IN_2_62_FOR(g_get_real_time)
575void g_get_current_time (GTimeVal *result);
576G_GNUC_END_IGNORE_DEPRECATIONS
577
578GLIB_AVAILABLE_IN_ALL
579gint64 g_get_monotonic_time (void);
580GLIB_AVAILABLE_IN_ALL
581gint64 g_get_real_time (void);
582
583
584/* Source manipulation by ID */
585GLIB_AVAILABLE_IN_ALL
586gboolean g_source_remove (guint tag);
587GLIB_AVAILABLE_IN_ALL
588gboolean g_source_remove_by_user_data (gpointer user_data);
589GLIB_AVAILABLE_IN_ALL
590gboolean g_source_remove_by_funcs_user_data (GSourceFuncs *funcs,
591 gpointer user_data);
592
593/**
594 * GClearHandleFunc:
595 * @handle_id: the handle ID to clear
596 *
597 * Specifies the type of function passed to g_clear_handle_id().
598 * The implementation is expected to free the resource identified
599 * by @handle_id; for instance, if @handle_id is a #GSource ID,
600 * g_source_remove() can be used.
601 *
602 * Since: 2.56
603 */
604typedef void (* GClearHandleFunc) (guint handle_id);
605
606GLIB_AVAILABLE_IN_2_56
607void g_clear_handle_id (guint *tag_ptr,
608 GClearHandleFunc clear_func);
609
610#define g_clear_handle_id(tag_ptr, clear_func) \
611 G_STMT_START { \
612 G_STATIC_ASSERT (sizeof *(tag_ptr) == sizeof (guint)); \
613 guint *_tag_ptr = (guint *) (tag_ptr); \
614 guint _handle_id; \
615 \
616 _handle_id = *_tag_ptr; \
617 if (_handle_id > 0) \
618 { \
619 *_tag_ptr = 0; \
620 clear_func (_handle_id); \
621 } \
622 } G_STMT_END \
623 GLIB_AVAILABLE_MACRO_IN_2_56
624
625/* Idles, child watchers and timeouts */
626GLIB_AVAILABLE_IN_ALL
627guint g_timeout_add_full (gint priority,
628 guint interval,
629 GSourceFunc function,
630 gpointer data,
631 GDestroyNotify notify);
632GLIB_AVAILABLE_IN_ALL
633guint g_timeout_add (guint interval,
634 GSourceFunc function,
635 gpointer data);
636GLIB_AVAILABLE_IN_ALL
637guint g_timeout_add_seconds_full (gint priority,
638 guint interval,
639 GSourceFunc function,
640 gpointer data,
641 GDestroyNotify notify);
642GLIB_AVAILABLE_IN_ALL
643guint g_timeout_add_seconds (guint interval,
644 GSourceFunc function,
645 gpointer data);
646GLIB_AVAILABLE_IN_ALL
647guint g_child_watch_add_full (gint priority,
648 GPid pid,
649 GChildWatchFunc function,
650 gpointer data,
651 GDestroyNotify notify);
652GLIB_AVAILABLE_IN_ALL
653guint g_child_watch_add (GPid pid,
654 GChildWatchFunc function,
655 gpointer data);
656GLIB_AVAILABLE_IN_ALL
657guint g_idle_add (GSourceFunc function,
658 gpointer data);
659GLIB_AVAILABLE_IN_ALL
660guint g_idle_add_full (gint priority,
661 GSourceFunc function,
662 gpointer data,
663 GDestroyNotify notify);
664GLIB_AVAILABLE_IN_ALL
665gboolean g_idle_remove_by_data (gpointer data);
666
667GLIB_AVAILABLE_IN_ALL
668void g_main_context_invoke_full (GMainContext *context,
669 gint priority,
670 GSourceFunc function,
671 gpointer data,
672 GDestroyNotify notify);
673GLIB_AVAILABLE_IN_ALL
674void g_main_context_invoke (GMainContext *context,
675 GSourceFunc function,
676 gpointer data);
677
678/* Hook for GClosure / GSource integration. Don't touch */
679GLIB_VAR GSourceFuncs g_timeout_funcs;
680GLIB_VAR GSourceFuncs g_child_watch_funcs;
681GLIB_VAR GSourceFuncs g_idle_funcs;
682#ifdef G_OS_UNIX
683GLIB_VAR GSourceFuncs g_unix_signal_funcs;
684GLIB_VAR GSourceFuncs g_unix_fd_source_funcs;
685#endif
686
687G_END_DECLS
688
689#endif /* __G_MAIN_H__ */
690