Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
gmain.h
Go to the documentation of this file.
1/* gmain.h - the GLib Main loop
2 * Copyright (C) 1998-2000 Red Hat, Inc.
3 *
4 * SPDX-License-Identifier: LGPL-2.1-or-later
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this library; if not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef __G_MAIN_H__
21#define __G_MAIN_H__
22
23#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
24#error "Only <glib.h> can be included directly."
25#endif
26
27#include <glib/gpoll.h>
28#include <glib/gslist.h>
29#include <glib/gthread.h>
30
32
33typedef enum /*< flags >*/
34{
40 G_IO_NVAL GLIB_SYSDEF_POLLNVAL
42
43/**
44 * GMainContextFlags:
45 * @G_MAIN_CONTEXT_FLAGS_NONE: Default behaviour.
46 * @G_MAIN_CONTEXT_FLAGS_OWNERLESS_POLLING: Assume that polling for events will
47 * free the thread to process other jobs. That's useful if you're using
48 * `g_main_context_{prepare,query,check,dispatch}` to integrate GMainContext in
49 * other event loops.
50 *
51 * Flags to pass to [ctor@GLib.MainContext.new_with_flags] which affect the
52 * behaviour of a [struct@GLib.MainContext].
53 *
54 * Since: 2.72
55 */
62
63
64/**
65 * GMainContext:
66 *
67 * The `GMainContext` struct is an opaque data
68 * type representing a set of sources to be handled in a main loop.
69 */
70typedef struct _GMainContext GMainContext;
71
72/**
73 * GMainLoop:
74 *
75 * The `GMainLoop` struct is an opaque data type
76 * representing the main event loop of a GLib or GTK application.
77 */
78typedef struct _GMainLoop GMainLoop;
79
80/**
81 * GSource:
82 *
83 * The `GSource` struct is an opaque data type
84 * representing an event source.
85 */
86typedef struct _GSource GSource;
87typedef struct _GSourcePrivate GSourcePrivate;
88
89/**
90 * GSourceCallbackFuncs:
91 * @ref: Called when a reference is added to the callback object
92 * @unref: Called when a reference to the callback object is dropped
93 * @get: Called to extract the callback function and data from the
94 * callback object.
95 *
96 * The `GSourceCallbackFuncs` struct contains
97 * functions for managing callback objects.
98 */
100
101/**
102 * GSourceFuncs:
103 * @prepare: Called before all the file descriptors are polled. If the
104 * source can determine that it is ready here (without waiting for the
105 * results of the poll() call) it should return %TRUE. It can also return
106 * a @timeout_ value which should be the maximum timeout (in milliseconds)
107 * which should be passed to the poll() call. The actual timeout used will
108 * be -1 if all sources returned -1, or it will be the minimum of all
109 * the @timeout_ values returned which were >= 0. Since 2.36 this may
110 * be %NULL, in which case the effect is as if the function always returns
111 * %FALSE with a timeout of -1. If @prepare returns a
112 * timeout and the source also has a ready time set, then the
113 * lower of the two will be used.
114 * @check: Called after all the file descriptors are polled. The source
115 * should return %TRUE if it is ready to be dispatched. Note that some
116 * time may have passed since the previous prepare function was called,
117 * so the source should be checked again here. Since 2.36 this may
118 * be %NULL, in which case the effect is as if the function always returns
119 * %FALSE.
120 * @dispatch: Called to dispatch the event source, after it has returned
121 * %TRUE in either its @prepare or its @check function, or if a ready time
122 * has been reached. The @dispatch function receives a callback function and
123 * user data. The callback function may be %NULL if the source was never
124 * connected to a callback using [method@GLib.Source.set_callback]. The
125 * @dispatch function should call the callback function with @user_data and
126 * whatever additional parameters are needed for this type of event source.
127 * The return value of the @dispatch function should be
128 * [const@GLib.SOURCE_REMOVE] if the source should be removed or
129 * [const@GLib.SOURCE_CONTINUE] to keep it.
130 * @finalize: Called when the source is finalized. At this point, the source
131 * will have been destroyed, had its callback cleared, and have been removed
132 * from its [struct@GLib.MainContext], but it will still have its final
133 * reference count, so methods can be called on it from within this
134 * function.
135 *
136 * The `GSourceFuncs` struct contains a table of
137 * functions used to handle event sources in a generic manner.
138 *
139 * For idle sources, the prepare and check functions always return %TRUE
140 * to indicate that the source is always ready to be processed. The prepare
141 * function also returns a timeout value of 0 to ensure that the poll() call
142 * doesn't block (since that would be time wasted which could have been spent
143 * running the idle function).
144 *
145 * For timeout sources, the prepare and check functions both return %TRUE
146 * if the timeout interval has expired. The prepare function also returns
147 * a timeout value to ensure that the poll() call doesn't block too long
148 * and miss the next timeout.
149 *
150 * For file descriptor sources, the prepare function typically returns %FALSE,
151 * since it must wait until poll() has been called before it knows whether
152 * any events need to be processed. It sets the returned timeout to -1 to
153 * indicate that it doesn't mind how long the poll() call blocks. In the
154 * check function, it tests the results of the poll() call to see if the
155 * required condition has been met, and returns %TRUE if so.
156 */
158
159/**
160 * GPid:
161 *
162 * A type which is used to hold a process identification.
163 *
164 * On UNIX, processes are identified by a process id (an integer),
165 * while Windows uses process handles (which are pointers).
166 *
167 * GPid is used in GLib only for descendant processes spawned with
168 * the g_spawn functions.
169 */
170/* defined in glibconfig.h */
171
172/**
173 * G_PID_FORMAT:
174 *
175 * A format specifier that can be used in printf()-style format strings
176 * when printing a #GPid.
177 *
178 * Since: 2.50
179 */
180/* defined in glibconfig.h */
181
182/**
183 * GSourceFunc:
184 * @user_data: data passed to the function, set when the source was
185 * created with one of the above functions
186 *
187 * Specifies the type of function passed to [func@GLib.timeout_add],
188 * [func@GLib.timeout_add_full], [func@GLib.idle_add], and
189 * [func@GLib.idle_add_full].
190 *
191 * When calling [method@GLib.Source.set_callback], you may need to cast a
192 * function of a different type to this type. Use [func@GLib.SOURCE_FUNC] to
193 * avoid warnings about incompatible function types.
194 *
195 * Returns: %FALSE if the source should be removed.
196 * [const@GLib.SOURCE_CONTINUE] and [const@GLib.SOURCE_REMOVE] are more
197 * memorable names for the return value.
198 */
199typedef gboolean (*GSourceFunc) (gpointer user_data);
200
201/**
202 * GSourceOnceFunc:
203 * @user_data: data passed to the function, set when the source was
204 * created
205 *
206 * A source function that is only called once before being removed from the main
207 * context automatically.
208 *
209 * See: [func@GLib.idle_add_once], [func@GLib.timeout_add_once]
210 *
211 * Since: 2.74
212 */
213typedef void (* GSourceOnceFunc) (gpointer user_data);
214
215/**
216 * G_SOURCE_FUNC:
217 * @f: a function pointer.
218 *
219 * Cast a function pointer to a [callback@GLib.SourceFunc], suppressing
220 * warnings from GCC 8 onwards with `-Wextra` or `-Wcast-function-type` enabled
221 * about the function types being incompatible.
222 *
223 * For example, the correct type of callback for a source created by
224 * [func@GLib.child_watch_source_new] is #GChildWatchFunc, which accepts more
225 * arguments than [callback@GLib.SourceFunc]. Casting the function with
226 * `(GSourceFunc)` to call [method@GLib.Source.set_callback] will trigger a
227 * warning, even though it will be cast back to the correct type before it is
228 * called by the source.
229 *
230 * Since: 2.58
231 */
232#define G_SOURCE_FUNC(f) ((GSourceFunc) (void (*)(void)) (f)) GLIB_AVAILABLE_MACRO_IN_2_58
233
234/**
235 * GChildWatchFunc:
236 * @pid: the process id of the child process
237 * @wait_status: Status information about the child process, encoded
238 * in a platform-specific manner
239 * @user_data: user data passed to [func@GLib.child_watch_add]
240 *
241 * Prototype of a #GChildWatchSource callback, called when a child
242 * process has exited.
243 *
244 * To interpret @wait_status, see the documentation for
245 * [func@GLib.spawn_check_wait_status]. In particular,
246 * on Unix platforms, note that it is usually not equal
247 * to the integer passed to `exit()` or returned from `main()`.
248 */
249typedef void (*GChildWatchFunc) (GPid pid,
250 gint wait_status,
251 gpointer user_data);
252
253
254/**
255 * GSourceDisposeFunc:
256 * @source: #GSource that is currently being disposed
257 *
258 * Dispose function for @source. See [method@GLib.Source.set_dispose_function]
259 * for details.
260 *
261 * Since: 2.64
262 */
264typedef void (*GSourceDisposeFunc) (GSource *source);
265
290
292{
293 void (*ref) (gpointer cb_data);
294 void (*unref) (gpointer cb_data);
295 void (*get) (gpointer cb_data,
296 GSource *source,
297 GSourceFunc *func,
298 gpointer *data);
299};
300
301/**
302 * GSourceDummyMarshal:
303 *
304 * This is just a placeholder for #GClosureMarshal,
305 * which cannot be used here for dependency reasons.
306 */
307typedef void (*GSourceDummyMarshal) (void);
308
309/**
310 * GSourceFuncsPrepareFunc:
311 * @source: The #GSource
312 * @timeout_: (out) (optional): the maximum timeout (in milliseconds) which should be passed to the poll call
313 *
314 * Checks the source for readiness.
315 *
316 * Called before all the file descriptors are polled. If the
317 * source can determine that it is ready here (without waiting for the
318 * results of the poll call) it should return %TRUE. It can also return
319 * a @timeout_ value which should be the maximum timeout (in milliseconds)
320 * which should be passed to the poll call. The actual timeout used will
321 * be `-1` if all sources returned `-1`, or it will be the minimum of all
322 * the @timeout_ values returned which were greater than or equal to `0`.
323 * If the prepare function returns a timeout and the source also has a
324 * ready time set, then the lower of the two will be used.
325 *
326 * Since 2.36 this may be `NULL`, in which case the effect is as if the
327 * function always returns `FALSE` with a timeout of `-1`.
328 *
329 * Returns: %TRUE if the source is ready, %FALSE otherwise
330 *
331 * Since: 2.82
332 */
334 gint *timeout_);
335
336/**
337 * GSourceFuncsCheckFunc:
338 * @source: The #GSource
339 *
340 * Checks if the source is ready to be dispatched.
341 *
342 * Called after all the file descriptors are polled. The source
343 * should return %TRUE if it is ready to be dispatched. Note that some
344 * time may have passed since the previous prepare function was called,
345 * so the source should be checked again here.
346 *
347 * Since 2.36 this may be `NULL`, in which case the effect is
348 * as if the function always returns `FALSE`.
349 *
350 * Returns: %TRUE if ready to be dispatched, %FALSE otherwise
351 *
352 * Since: 2.82
353 */
355
356/**
357 * GSourceFuncsDispatchFunc:
358 * @source: The #GSource
359 * @callback: (nullable): The #GSourceFunc to call
360 * @user_data: (nullable): data to pass to @callback
361 *
362 * Dispatches the source callback.
363 *
364 * Called to dispatch the event source, after it has returned
365 * `TRUE` in either its prepare or its check function, or if a ready time
366 * has been reached. The dispatch function receives a callback function and
367 * user data. The callback function may be `NULL` if the source was never
368 * connected to a callback using [method@GLib.Source.set_callback]. The dispatch
369 * function should call the callback function with @user_data and whatever
370 * additional parameters are needed for this type of event source. The
371 * return value of the dispatch function should be [const@GLib.SOURCE_REMOVE]
372 * if the source should be removed or [const@GLib.SOURCE_CONTINUE] to keep it.
373 *
374 * Returns: [const@GLib.SOURCE_REMOVE] if the source should be removed,
375 * [const@GLib.SOURCE_CONTINUE] otherwise.
376 *
377 * Since: 2.82
378 */
380 GSourceFunc callback,
381 gpointer user_data);
382
383/**
384 * GSourceFuncsFinalizeFunc:
385 * @source: The #GSource
386 *
387 * Finalizes the source.
388 *
389 * Called when the source is finalized. At this point, the source
390 * will have been destroyed, had its callback cleared, and have been removed
391 * from its [type@GLib.MainContext], but it will still have its final reference
392 * count, so methods can be called on it from within this function.
393 *
394 * Since: 2.82
395 */
396typedef void (*GSourceFuncsFinalizeFunc) (GSource *source);
397
399{
401 GSourceFuncsCheckFunc check; /* Can be NULL */
404
405 /*< private >*/
406 /* For use by g_source_set_closure */
408 GSourceDummyMarshal closure_marshal; /* Really is of type GClosureMarshal */
409};
410
411/* Standard priorities */
412
413/**
414 * G_PRIORITY_HIGH:
415 *
416 * Use this for high priority event sources.
417 *
418 * It is not used within GLib or GTK.
419 */
420#define G_PRIORITY_HIGH -100
421
422/**
423 * G_PRIORITY_DEFAULT:
424 *
425 * Use this for default priority event sources.
426 *
427 * In GLib this priority is used when adding timeout functions
428 * with [func@GLib.timeout_add]. In GDK this priority is used for events
429 * from the X server.
430 */
431#define G_PRIORITY_DEFAULT 0
432
433/**
434 * G_PRIORITY_HIGH_IDLE:
435 *
436 * Use this for high priority idle functions.
437 *
438 * GTK uses %G_PRIORITY_HIGH_IDLE + 10 for resizing operations,
439 * and %G_PRIORITY_HIGH_IDLE + 20 for redrawing operations. (This is
440 * done to ensure that any pending resizes are processed before any
441 * pending redraws, so that widgets are not redrawn twice unnecessarily.)
442 */
443#define G_PRIORITY_HIGH_IDLE 100
444
445/**
446 * G_PRIORITY_DEFAULT_IDLE:
447 *
448 * Use this for default priority idle functions.
449 *
450 * In GLib this priority is used when adding idle functions with
451 * [func@GLib.idle_add].
452 */
453#define G_PRIORITY_DEFAULT_IDLE 200
454
455/**
456 * G_PRIORITY_LOW:
457 *
458 * Use this for very low priority background tasks.
459 *
460 * It is not used within GLib or GTK.
461 */
462#define G_PRIORITY_LOW 300
463
464/**
465 * G_SOURCE_REMOVE:
466 *
467 * Use this macro as the return value of a [callback@GLib.SourceFunc] to remove
468 * the [struct@GLib.Source] from the main loop.
469 *
470 * Since: 2.32
471 */
472#define G_SOURCE_REMOVE FALSE
473
474/**
475 * G_SOURCE_CONTINUE:
476 *
477 * Use this macro as the return value of a [callback@GLib.SourceFunc] to leave
478 * the [struct@GLib.Source] in the main loop.
479 *
480 * Since: 2.32
481 */
482#define G_SOURCE_CONTINUE TRUE
483
484/* GMainContext: */
485
498
501 gboolean may_block);
504
505/* For implementation of legacy interfaces
506 */
509 guint source_id);
512 gpointer user_data);
516 gpointer user_data);
517
518/* Low level functions for implementing custom main loops.
519 */
530 GCond *cond,
531 GMutex *mutex);
532
535 gint *priority);
538 gint max_priority,
539 gint *timeout_,
540 GPollFD *fds,
541 gint n_fds);
544 gint max_priority,
545 GPollFD *fds,
546 gint n_fds);
549
552 GPollFunc func);
555
556/* Low level functions for use by source implementations
557 */
560 GPollFD *fd,
561 gint priority);
564 GPollFD *fd);
565
570
571/* GMainContexts for other threads
572 */
581
582/**
583 * GMainContextPusher:
584 *
585 * Opaque type. See g_main_context_pusher_new() for details.
586 *
587 * Since: 2.64
588 */
589typedef void GMainContextPusher GLIB_AVAILABLE_TYPE_IN_2_64;
590
591/**
592 * g_main_context_pusher_new:
593 * @main_context: (transfer none): a main context to push
594 *
595 * Push @main_context as the new thread-default main context for the current
596 * thread, using [method@GLib.MainContext.push_thread_default], and return a
597 * new [alias@GLib.MainContextPusher]. Pop with g_main_context_pusher_free().
598 * Using [method@GLib.MainContext.pop_thread_default] on @main_context while a
599 * [alias@GLib.MainContextPusher] exists for it can lead to undefined behaviour.
600 *
601 * Using two [alias@GLib.MainContextPusher]s in the same scope is not allowed,
602 * as it leads to an undefined pop order.
603 *
604 * This is intended to be used with g_autoptr(). Note that g_autoptr()
605 * is only available when using GCC or clang, so the following example
606 * will only work with those compilers:
607 * |[
608 * typedef struct
609 * {
610 * ...
611 * GMainContext *context;
612 * ...
613 * } MyObject;
614 *
615 * static void
616 * my_object_do_stuff (MyObject *self)
617 * {
618 * g_autoptr(GMainContextPusher) pusher = g_main_context_pusher_new (self->context);
619 *
620 * // Code with main context as the thread default here
621 *
622 * if (cond)
623 * // No need to pop
624 * return;
625 *
626 * // Optionally early pop
627 * g_clear_pointer (&pusher, g_main_context_pusher_free);
628 *
629 * // Code with main context no longer the thread default here
630 * }
631 * ]|
632 *
633 * Returns: (transfer full): a #GMainContextPusher
634 * Since: 2.64
635 */
638static inline GMainContextPusher *
640{
642 return (GMainContextPusher *) main_context;
643}
645
646/**
647 * g_main_context_pusher_free:
648 * @pusher: (transfer full): a #GMainContextPusher
649 *
650 * Pop @pusher’s main context as the thread default main context.
651 * See g_main_context_pusher_new() for details.
652 *
653 * This will pop the [struct@GLib.MainContext] as the current thread-default
654 * main context, but will not call [method@GLib.MainContext.unref] on it.
655 *
656 * Since: 2.64
657 */
660static inline void
661g_main_context_pusher_free (GMainContextPusher *pusher)
662{
664}
666
667/* GMainLoop: */
668
671 gboolean is_running);
684
685/* GSource: */
686
689 guint struct_size);
690
694 GSourceDisposeFunc dispose);
696
700void g_source_unref (GSource *source);
701
704 GMainContext *context);
707
710 gint priority);
715 gboolean can_recurse);
720
723
726 GSourceFunc func,
727 gpointer data,
728 GDestroyNotify notify);
729
735
738 const char *name);
741 const char *name);
743const char * g_source_get_name (GSource *source);
746 const char *name);
747
750 gint64 ready_time);
753
754#ifdef G_OS_UNIX
757 gint fd,
758 GIOCondition events);
761 gpointer tag,
762 GIOCondition new_events);
765 gpointer tag);
768 gpointer tag);
769#endif
770
771/* Used to implement g_source_connect_closure and internally*/
774 gpointer callback_data,
775 GSourceCallbackFuncs *callback_funcs);
776
779 GPollFD *fd);
782 GPollFD *fd);
783
786 GSource *child_source);
789 GSource *child_source);
790
794 GTimeVal *timeval);
796
799
800 /* void g_source_connect_closure (GSource *source,
801 GClosure *closure);
802 */
803
804/* Specific source types
805 */
814
815/* Miscellaneous functions
816 */
819void g_get_current_time (GTimeVal *result);
821
826
827
828/* Source manipulation by ID */
835 gpointer user_data);
836
837/**
838 * GClearHandleFunc:
839 * @handle_id: the handle ID to clear
840 *
841 * Specifies the type of function passed to [func@GLib.clear_handle_id] The
842 * implementation is expected to free the resource identified by @handle_id;
843 * for instance, if @handle_id is a [struct@GLib.Source] ID,
844 * [func@GLib.Source.remove] can be used.
845 *
846 * Since: 2.56
847 */
848typedef void (* GClearHandleFunc) (guint handle_id);
849
852 GClearHandleFunc clear_func);
853
854#define g_clear_handle_id(tag_ptr, clear_func) \
855 G_STMT_START { \
856 G_STATIC_ASSERT (sizeof *(tag_ptr) == sizeof (guint)); \
857 guint *_tag_ptr = (guint *) (tag_ptr); \
858 guint _handle_id; \
859 \
860 _handle_id = *_tag_ptr; \
861 if (_handle_id > 0) \
862 { \
863 *_tag_ptr = 0; \
864 clear_func (_handle_id); \
865 } \
866 } G_STMT_END \
867 GLIB_AVAILABLE_MACRO_IN_2_56
868
869/* Idles, child watchers and timeouts */
872 guint interval,
873 GSourceFunc function,
874 gpointer data,
875 GDestroyNotify notify);
878 GSourceFunc function,
879 gpointer data);
882 GSourceOnceFunc function,
883 gpointer data);
886 guint interval,
887 GSourceFunc function,
888 gpointer data,
889 GDestroyNotify notify);
892 GSourceFunc function,
893 gpointer data);
896 GSourceOnceFunc function,
897 gpointer data);
900 GPid pid,
901 GChildWatchFunc function,
902 gpointer data,
903 GDestroyNotify notify);
906 GChildWatchFunc function,
907 gpointer data);
910 gpointer data);
913 GSourceFunc function,
914 gpointer data,
915 GDestroyNotify notify);
918 gpointer data);
921
925 GSourceFunc function,
926 gpointer data,
927 GDestroyNotify notify);
930 GSourceFunc function,
931 gpointer data);
932
934static inline int
935g_steal_fd (int *fd_ptr)
936{
937 int fd = *fd_ptr;
938 *fd_ptr = -1;
939 return fd;
940}
941
942/* Hook for GClosure / GSource integration. Don't touch */
946#ifdef G_OS_UNIX
949#endif
950
952
953#endif /* __G_MAIN_H__ */
GStaticMutex mutex
#define GLIB_AVAILABLE_STATIC_INLINE_IN_2_64
#define GLIB_AVAILABLE_STATIC_INLINE_IN_2_70
#define GLIB_DEPRECATED_IN_2_62_FOR(f)
#define GLIB_AVAILABLE_IN_2_72
#define GLIB_AVAILABLE_IN_2_36
#define GLIB_DEPRECATED_IN_2_58_FOR(f)
#define GLIB_AVAILABLE_IN_2_70
#define GLIB_AVAILABLE_IN_ALL
#define GLIB_AVAILABLE_IN_2_74
#define GLIB_VAR
#define GLIB_AVAILABLE_IN_2_78
#define GLIB_AVAILABLE_IN_2_64
#define GLIB_DEPRECATED_IN_2_28_FOR(f)
#define GLIB_AVAILABLE_IN_2_56
#define GLIB_AVAILABLE_TYPE_IN_2_72
signed long gint64
Definition glibconfig.h:66
int GPid
Definition glibconfig.h:201
#define inline
Definition gmacros.h:131
#define G_END_DECLS
Definition gmacros.h:910
#define G_BEGIN_DECLS
Definition gmacros.h:909
#define G_GNUC_BEGIN_IGNORE_DEPRECATIONS
Definition gmacros.h:771
#define G_GNUC_END_IGNORE_DEPRECATIONS
Definition gmacros.h:772
G_GNUC_BEGIN_IGNORE_DEPRECATIONS void g_get_current_time(GTimeVal *result)
GLIB_AVAILABLE_IN_ALL GMainContext * g_main_loop_get_context(GMainLoop *loop)
GLIB_AVAILABLE_IN_ALL guint g_idle_add_full(gint priority, GSourceFunc function, gpointer data, GDestroyNotify notify)
GLIB_AVAILABLE_IN_ALL void g_main_context_remove_poll(GMainContext *context, GPollFD *fd)
GLIB_AVAILABLE_IN_ALL void g_source_add_poll(GSource *source, GPollFD *fd)
GLIB_AVAILABLE_IN_ALL void g_source_set_priority(GSource *source, gint priority)
GLIB_AVAILABLE_IN_ALL guint g_source_attach(GSource *source, GMainContext *context)
GLIB_AVAILABLE_IN_ALL guint g_timeout_add(guint interval, GSourceFunc function, gpointer data)
GLIB_AVAILABLE_IN_ALL gboolean g_main_context_prepare(GMainContext *context, gint *priority)
GLIB_AVAILABLE_IN_ALL gint g_main_depth(void)
G_GNUC_BEGIN_IGNORE_DEPRECATIONS GLIB_AVAILABLE_IN_2_72 GMainContext * g_main_context_new_with_flags(GMainContextFlags flags)
GLIB_AVAILABLE_IN_2_74 guint g_idle_add_once(GSourceOnceFunc function, gpointer data)
GLIB_AVAILABLE_IN_ALL GSource * g_main_context_find_source_by_id(GMainContext *context, guint source_id)
G_GNUC_END_IGNORE_DEPRECATIONS GLIB_AVAILABLE_IN_ALL GSource * g_source_ref(GSource *source)
GLIB_AVAILABLE_IN_2_36 void g_source_set_ready_time(GSource *source, gint64 ready_time)
GLIB_AVAILABLE_IN_ALL GSource * g_main_context_find_source_by_user_data(GMainContext *context, gpointer user_data)
void(* GChildWatchFunc)(GPid pid, gint wait_status, gpointer user_data)
Definition gmain.h:249
G_GNUC_END_IGNORE_DEPRECATIONS GLIB_AVAILABLE_IN_ALL GMainContext * g_main_context_ref(GMainContext *context)
GLIB_AVAILABLE_IN_ALL GSource * g_timeout_source_new(guint interval)
GLIB_AVAILABLE_IN_ALL const char * g_source_get_name(GSource *source)
GLIB_AVAILABLE_IN_ALL void g_main_loop_unref(GMainLoop *loop)
GLIB_AVAILABLE_IN_ALL gboolean g_main_context_acquire(GMainContext *context)
GLIB_AVAILABLE_IN_ALL GSource * g_main_context_find_source_by_funcs_user_data(GMainContext *context, GSourceFuncs *funcs, gpointer user_data)
G_GNUC_END_IGNORE_DEPRECATIONS GLIB_AVAILABLE_IN_ALL gint64 g_source_get_time(GSource *source)
#define g_clear_handle_id(tag_ptr, clear_func)
Definition gmain.h:854
GLIB_AVAILABLE_TYPE_IN_2_64 typedef void(* GSourceDisposeFunc)(GSource *source)
Definition gmain.h:264
struct _GMainContext GMainContext
Definition gmain.h:70
GLIB_AVAILABLE_IN_ALL gboolean g_source_is_destroyed(GSource *source)
GLIB_AVAILABLE_IN_ALL gboolean g_source_remove_by_user_data(gpointer user_data)
GLIB_AVAILABLE_IN_ALL GPollFunc g_main_context_get_poll_func(GMainContext *context)
GLIB_AVAILABLE_IN_ALL void g_main_context_dispatch(GMainContext *context)
struct _GMainLoop GMainLoop
Definition gmain.h:78
gboolean g_main_context_wait(GMainContext *context, GCond *cond, GMutex *mutex)
GLIB_VAR GSourceFuncs g_child_watch_funcs
Definition gmain.h:944
GLIB_AVAILABLE_IN_ALL void g_source_remove_poll(GSource *source, GPollFD *fd)
GLIB_AVAILABLE_IN_ALL guint g_child_watch_add(GPid pid, GChildWatchFunc function, gpointer data)
GLIB_AVAILABLE_IN_ALL GMainContext * g_main_context_ref_thread_default(void)
GLIB_AVAILABLE_IN_2_36 void g_source_remove_unix_fd(GSource *source, gpointer tag)
GLIB_AVAILABLE_IN_ALL gboolean g_main_context_is_owner(GMainContext *context)
GLIB_AVAILABLE_IN_ALL GSource * g_child_watch_source_new(GPid pid)
GLIB_AVAILABLE_IN_ALL void g_main_context_invoke_full(GMainContext *context, gint priority, GSourceFunc function, gpointer data, GDestroyNotify notify)
GLIB_AVAILABLE_IN_ALL GMainContext * g_main_context_get_thread_default(void)
GLIB_AVAILABLE_IN_ALL guint g_timeout_add_full(gint priority, guint interval, GSourceFunc function, gpointer data, GDestroyNotify notify)
GLIB_AVAILABLE_IN_ALL void g_main_loop_quit(GMainLoop *loop)
GLIB_AVAILABLE_IN_ALL GMainContext * g_main_context_new(void)
GLIB_AVAILABLE_IN_ALL guint g_child_watch_add_full(gint priority, GPid pid, GChildWatchFunc function, gpointer data, GDestroyNotify notify)
GLIB_AVAILABLE_IN_ALL GMainLoop * g_main_loop_ref(GMainLoop *loop)
GLIB_AVAILABLE_IN_ALL void g_main_context_push_thread_default(GMainContext *context)
void(* GSourceDummyMarshal)(void)
Definition gmain.h:307
void(* GSourceFuncsFinalizeFunc)(GSource *source)
Definition gmain.h:396
GIOCondition
Definition gmain.h:34
@ GLIB_SYSDEF_POLLERR
Definition gmain.h:38
@ GLIB_SYSDEF_POLLOUT
Definition gmain.h:36
@ GLIB_SYSDEF_POLLHUP
Definition gmain.h:39
@ GLIB_SYSDEF_POLLPRI
Definition gmain.h:37
@ GLIB_SYSDEF_POLLNVAL
Definition gmain.h:40
@ GLIB_SYSDEF_POLLIN
Definition gmain.h:35
GLIB_AVAILABLE_IN_ALL void g_source_remove_child_source(GSource *source, GSource *child_source)
GLIB_AVAILABLE_IN_ALL void g_main_context_add_poll(GMainContext *context, GPollFD *fd, gint priority)
GLIB_AVAILABLE_IN_ALL gboolean g_main_loop_is_running(GMainLoop *loop)
G_GNUC_END_IGNORE_DEPRECATIONS GLIB_AVAILABLE_IN_ALL gint64 g_get_monotonic_time(void)
GLIB_AVAILABLE_IN_2_36 void g_source_modify_unix_fd(GSource *source, gpointer tag, GIOCondition new_events)
GLIB_AVAILABLE_IN_ALL void g_source_destroy(GSource *source)
gboolean(* GSourceFunc)(gpointer user_data)
Definition gmain.h:199
GLIB_AVAILABLE_IN_2_70 void g_source_set_static_name(GSource *source, const char *name)
G_GNUC_END_IGNORE_DEPRECATIONS G_GNUC_BEGIN_IGNORE_DEPRECATIONS static GLIB_AVAILABLE_STATIC_INLINE_IN_2_64 void g_main_context_pusher_free(GMainContextPusher *pusher)
Definition gmain.h:661
G_GNUC_END_IGNORE_DEPRECATIONS GLIB_AVAILABLE_IN_ALL GMainLoop * g_main_loop_new(GMainContext *context, gboolean is_running)
GLIB_AVAILABLE_IN_ALL gboolean g_main_context_iteration(GMainContext *context, gboolean may_block)
GLIB_AVAILABLE_IN_ALL gboolean g_idle_remove_by_data(gpointer data)
GLIB_AVAILABLE_IN_ALL GMainContext * g_source_get_context(GSource *source)
GLIB_AVAILABLE_IN_2_36 gint64 g_source_get_ready_time(GSource *source)
GLIB_AVAILABLE_IN_ALL gboolean g_main_context_pending(GMainContext *context)
GLIB_VAR GSourceFuncs g_unix_fd_source_funcs
Definition gmain.h:948
GLIB_VAR GSourceFuncs g_unix_signal_funcs
Definition gmain.h:947
GLIB_AVAILABLE_IN_ALL void g_main_context_pop_thread_default(GMainContext *context)
GLIB_VAR GSourceFuncs g_timeout_funcs
Definition gmain.h:943
GLIB_AVAILABLE_IN_ALL gboolean g_main_context_check(GMainContext *context, gint max_priority, GPollFD *fds, gint n_fds)
GLIB_AVAILABLE_IN_ALL GSource * g_idle_source_new(void)
GLIB_AVAILABLE_IN_ALL gint g_source_get_priority(GSource *source)
GLIB_AVAILABLE_IN_ALL void g_source_set_can_recurse(GSource *source, gboolean can_recurse)
GLIB_AVAILABLE_IN_ALL void g_main_loop_run(GMainLoop *loop)
GLIB_AVAILABLE_IN_ALL void g_source_add_child_source(GSource *source, GSource *child_source)
GLIB_AVAILABLE_IN_ALL guint g_timeout_add_seconds_full(gint priority, guint interval, GSourceFunc function, gpointer data, GDestroyNotify notify)
GLIB_AVAILABLE_IN_ALL void g_main_context_unref(GMainContext *context)
G_GNUC_BEGIN_IGNORE_DEPRECATIONS void g_source_get_current_time(GSource *source, GTimeVal *timeval)
static GLIB_AVAILABLE_STATIC_INLINE_IN_2_70 int g_steal_fd(int *fd_ptr)
Definition gmain.h:935
gboolean(* GSourceFuncsPrepareFunc)(GSource *source, gint *timeout_)
Definition gmain.h:333
GLIB_AVAILABLE_IN_ALL guint g_timeout_add_seconds(guint interval, GSourceFunc function, gpointer data)
GLIB_AVAILABLE_IN_ALL void g_main_context_invoke(GMainContext *context, GSourceFunc function, gpointer data)
GLIB_AVAILABLE_IN_ALL void g_main_context_set_poll_func(GMainContext *context, GPollFunc func)
GLIB_AVAILABLE_IN_ALL gboolean g_source_get_can_recurse(GSource *source)
void(* GSourceOnceFunc)(gpointer user_data)
Definition gmain.h:213
GLIB_VAR GSourceFuncs g_idle_funcs
Definition gmain.h:945
GLIB_AVAILABLE_IN_2_78 guint g_timeout_add_seconds_once(guint interval, GSourceOnceFunc function, gpointer data)
GLIB_AVAILABLE_IN_ALL gint64 g_get_real_time(void)
GLIB_AVAILABLE_IN_ALL GSource * g_source_new(GSourceFuncs *source_funcs, guint struct_size)
GMainContextFlags
Definition gmain.h:58
@ G_MAIN_CONTEXT_FLAGS_NONE
Definition gmain.h:59
@ G_MAIN_CONTEXT_FLAGS_OWNERLESS_POLLING
Definition gmain.h:60
GLIB_AVAILABLE_IN_ALL gint g_main_context_query(GMainContext *context, gint max_priority, gint *timeout_, GPollFD *fds, gint n_fds)
GLIB_AVAILABLE_IN_ALL void g_main_context_wakeup(GMainContext *context)
GLIB_AVAILABLE_IN_ALL void g_source_set_funcs(GSource *source, GSourceFuncs *funcs)
GLIB_AVAILABLE_IN_2_36 gpointer g_source_add_unix_fd(GSource *source, gint fd, GIOCondition events)
GLIB_AVAILABLE_IN_2_74 guint g_timeout_add_once(guint interval, GSourceOnceFunc function, gpointer data)
GLIB_AVAILABLE_IN_ALL GMainContext * g_main_context_default(void)
GLIB_AVAILABLE_IN_ALL gboolean g_source_remove(guint tag)
GLIB_AVAILABLE_IN_ALL GSource * g_main_current_source(void)
GLIB_AVAILABLE_IN_ALL guint g_source_get_id(GSource *source)
GLIB_AVAILABLE_IN_ALL gboolean g_source_remove_by_funcs_user_data(GSourceFuncs *funcs, gpointer user_data)
GLIB_AVAILABLE_IN_ALL void g_source_set_callback(GSource *source, GSourceFunc func, gpointer data, GDestroyNotify notify)
gboolean(* GSourceFuncsCheckFunc)(GSource *source)
Definition gmain.h:354
GLIB_AVAILABLE_IN_2_36 GIOCondition g_source_query_unix_fd(GSource *source, gpointer tag)
GLIB_AVAILABLE_IN_ALL void g_source_unref(GSource *source)
GLIB_AVAILABLE_IN_ALL void g_source_set_name(GSource *source, const char *name)
void GMainContextPusher GLIB_AVAILABLE_TYPE_IN_2_64
Definition gmain.h:589
GLIB_AVAILABLE_IN_ALL GSource * g_timeout_source_new_seconds(guint interval)
struct _GSourcePrivate GSourcePrivate
Definition gmain.h:87
gboolean(* GSourceFuncsDispatchFunc)(GSource *source, GSourceFunc callback, gpointer user_data)
Definition gmain.h:379
G_GNUC_BEGIN_IGNORE_DEPRECATIONS static GLIB_AVAILABLE_STATIC_INLINE_IN_2_64 GMainContextPusher * g_main_context_pusher_new(GMainContext *main_context)
Definition gmain.h:639
GLIB_AVAILABLE_IN_ALL guint g_idle_add(GSourceFunc function, gpointer data)
GLIB_AVAILABLE_IN_ALL void g_source_set_callback_indirect(GSource *source, gpointer callback_data, GSourceCallbackFuncs *callback_funcs)
GLIB_AVAILABLE_IN_ALL void g_main_context_release(GMainContext *context)
G_GNUC_BEGIN_IGNORE_DEPRECATIONS GLIB_AVAILABLE_IN_2_64 void g_source_set_dispose_function(GSource *source, GSourceDisposeFunc dispose)
GLIB_AVAILABLE_IN_ALL void g_source_set_name_by_id(guint tag, const char *name)
void(* GClearHandleFunc)(guint handle_id)
Definition gmain.h:848
gint(* GPollFunc)(GPollFD *ufds, guint nfsd, gint timeout_)
Definition gpoll.h:76
typedefG_BEGIN_DECLS struct _GPollFD GPollFD
Definition gpoll.h:61
typedefG_BEGIN_DECLS struct _GSList GSList
Definition gslist.h:39
gint gboolean
Definition gtypes.h:56
void * gpointer
Definition gtypes.h:109
int gint
Definition gtypes.h:55
void(* GDestroyNotify)(gpointer data)
Definition gtypes.h:140
unsigned int guint
Definition gtypes.h:61
const char * name
Definition lsqlite3.c:2154
static int cond(LexState *ls)
static const struct @51 priority[]
static const luaL_Reg funcs[]
void(* unref)(gpointer cb_data)
Definition gmain.h:294
void(* get)(gpointer cb_data, GSource *source, GSourceFunc *func, gpointer *data)
Definition gmain.h:295
void(* ref)(gpointer cb_data)
Definition gmain.h:293
GSourceFuncsDispatchFunc dispatch
Definition gmain.h:402
GSourceFuncsPrepareFunc prepare
Definition gmain.h:400
GSourceFuncsFinalizeFunc finalize
Definition gmain.h:403
GSourceFuncsCheckFunc check
Definition gmain.h:401
GSourceFunc closure_callback
Definition gmain.h:407
GSourceDummyMarshal closure_marshal
Definition gmain.h:408
gpointer callback_data
Definition gmain.h:269
GSourcePrivate * priv
Definition gmain.h:288
gint priority
Definition gmain.h:277
const GSourceFuncs * source_funcs
Definition gmain.h:272
GSource * next
Definition gmain.h:284
GSourceCallbackFuncs * callback_funcs
Definition gmain.h:270
GSource * prev
Definition gmain.h:283
guint source_id
Definition gmain.h:279
guint flags
Definition gmain.h:278
GMainContext * context
Definition gmain.h:275
guint ref_count
Definition gmain.h:273
GSList * poll_fds
Definition gmain.h:281
char * name
Definition gmain.h:286