alternative to assert
[gtkD.git] / src / glib / Child.d
blobfc934f20cf6063e9944bb8a1bdc7dde6e241cc08
1 /*
2 * This file is part of duit.
4 * duit is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * duit 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
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with duit; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile =
26 * outPack = glib
27 * outFile = Child
28 * strct =
29 * realStrct=
30 * ctorStrct=
31 * clss = Child
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - g_child_
40 * omit structs:
41 * omit prefixes:
42 * omit code:
43 * imports:
44 * - glib.MainLoop
45 * - glib.Dataset
46 * structWrap:
47 * - GDataset* -> Dataset
48 * - GMainLoop* -> MainLoop
49 * local aliases:
52 module glib.Child;
54 private import glib.glibtypes;
56 private import lib.glib;
58 private import glib.MainLoop;
59 private import glib.Dataset;
61 /**
62 * Description
63 * The main event loop manages all the available sources of events for
64 * GLib and GTK+ applications. These events can come from any number of
65 * different types of sources such as file descriptors (plain files,
66 * pipes or sockets) and timeouts. New types of event sources can also
67 * be added using g_source_attach().
68 * To allow multiple independent sets of sources to be handled in
69 * different threads, each source is associated with a GMainContext.
70 * A GMainContext can only be running in a single thread, but
71 * sources can be added to it and removed from it from other threads.
72 * Each event source is assigned a priority. The default priority,
73 * G_PRIORITY_DEFAULT, is 0. Values less than 0 denote higher
74 * priorities. Values greater than 0 denote lower priorities. Events
75 * from high priority sources are always processed before events from
76 * lower priority sources.
77 * Idle functions can also be added, and assigned a priority. These will
78 * be run whenever no events with a higher priority are ready to be
79 * processed.
80 * The GMainLoop data type represents a main event loop. A GMainLoop
81 * is created with g_main_loop_new(). After adding the initial event sources,
82 * g_main_loop_run() is called. This continuously checks for new events from
83 * each of the event sources and dispatches them. Finally, the
84 * processing of an event from one of the sources leads to a call to
85 * g_main_loop_quit() to exit the main loop, and g_main_loop_run() returns.
86 * It is possible to create new instances of GMainLoop recursively.
87 * This is often used in GTK+ applications when showing modal dialog
88 * boxes. Note that event sources are associated with a particular
89 * GMainContext, and will be checked and dispatched for all main
90 * loops associated with that GMainContext.
91 * GTK+ contains wrappers of some of these functions, e.g. gtk_main(),
92 * gtk_main_quit() and gtk_events_pending().
93 * Creating new sources types
94 * One of the unusual features of the GTK+ main loop functionality
95 * is that new types of event source can be created and used in
96 * addition to the builtin type of event source. A new event source
97 * type is used for handling GDK events. A new source type is
98 * created by deriving from the GSource
99 * structure. The derived type of source is represented by a
100 * structure that has the GSource structure as a first element,
101 * and other elements specific to the new source type. To create
102 * an instance of the new source type, call g_source_new() passing
103 * in the size of the derived structure and a table of functions.
104 * These GSourceFuncs determine the behavior of the new source
105 * types.
106 * New source types basically interact with with the main context
107 * in two ways. Their prepare function in GSourceFuncs can set
108 * a timeout to determine the maximum amount of time that the
109 * main loop will sleep before checking the source again. In
110 * addition, or as well, the source can add file descriptors to
111 * the set that the main context checks using g_source_add_poll().
112 * <hr>
113 * Customizing the main loop iteration
114 * Single iterations of a GMainContext can be run with
115 * g_main_context_iteration(). In some cases, more detailed control
116 * of exactly how the details of the main loop work is desired,
117 * for instance, when integrating the GMainLoop with an external
118 * main loop. In such cases, you can call the component functions
119 * of g_main_context_iteration() directly. These functions
120 * are g_main_context_prepare(), g_main_context_query(),
121 * g_main_context_check() and g_main_context_dispatch().
122 * The operation of these functions can best be seen in terms
123 * of a state diagram, as shown in Figure1, States of a Main Context.
124 * Figure1.States of a Main Context
126 public class Child
191 * Creates a new child_watch source.
192 * The source will not initially be associated with any GMainContext
193 * and must be added to one with g_source_attach() before it will be
194 * executed.
195 * Note that child watch sources can only be used in conjunction with
196 * g_spawn... when the G_SPAWN_DO_NOT_REAP_CHILD
197 * flag is used.
198 * Note that on platforms where GPid must be explicitly closed
199 * (see g_spawn_close_pid()) pid must not be closed while the
200 * source is still active. Typically, you will want to call
201 * g_spawn_close_pid() in the callback function for the source.
202 * Note further that using g_child_watch_source_new() is not
203 * compatible with calling waitpid(-1) in
204 * the application. Calling waitpid() for individual pids will
205 * still work fine.
206 * pid:
207 * process id of a child process to watch. On Windows, a HANDLE
208 * for the process to watch (which actually doesn't have to be a child).
209 * Returns:
210 * the newly-created child watch source
211 * Since 2.4
213 public static GSource* watchSourceNew(GPid pid)
215 // GSource* g_child_watch_source_new (GPid pid);
216 return g_child_watch_source_new(pid);
220 * Sets a function to be called when the child indicated by pid exits, at a
221 * default priority, G_PRIORITY_DEFAULT.
222 * Note that on platforms where GPid must be explicitly closed
223 * (see g_spawn_close_pid()) pid must not be closed while the
224 * source is still active. Typically, you will want to call
225 * g_spawn_close_pid() in the callback function for the source.
226 * GLib supports only a single callback per process id.
227 * pid:
228 * process id of a child process to watch
229 * function:
230 * function to call
231 * data:
232 * data to pass to function
233 * Returns:
234 * the ID (greater than 0) of the event source.
235 * Since 2.4
237 public static uint watchAdd(GPid pid, GChildWatchFunc funct, void* data)
239 // guint g_child_watch_add (GPid pid, GChildWatchFunc function, gpointer data);
240 return g_child_watch_add(pid, funct, data);
244 * Sets a function to be called when the child indicated by pid exits, at a
245 * default priority, G_PRIORITY_DEFAULT.
246 * Note that on platforms where GPid must be explicitly closed
247 * (see g_spawn_close_pid()) pid must not be closed while the
248 * source is still active. Typically, you will want to call
249 * g_spawn_close_pid() in the callback function for the source.
250 * GLib supports only a single callback per process id.
251 * priority:
252 * the priority of the idle source. Typically this will be in the
253 * range between G_PRIORITY_DEFAULT_IDLE and G_PRIORITY_HIGH_IDLE.
254 * pid:
255 * process id of a child process to watch
256 * function:
257 * function to call
258 * data:
259 * data to pass to function
260 * notify:
261 * function to call when the idle is removed, or NULL
262 * Returns:
263 * the ID (greater than 0) of the event source.
264 * Since 2.4
266 public static uint watchAddFull(int priority, GPid pid, GChildWatchFunc funct, void* data, GDestroyNotify notify)
268 // guint g_child_watch_add_full (gint priority, GPid pid, GChildWatchFunc function, gpointer data, GDestroyNotify notify);
269 return g_child_watch_add_full(priority, pid, funct, data, notify);