annotate dwt/internal/gtk/c/gthreadtypes.d @ 11:5f725d09c076

Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
author John Reimer<terminal.node@gmail.com>
date Sat, 05 Jan 2008 15:13:44 -0800
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
1 /******************************************************************************
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
2
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
3 This file is part of gtkD.
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
4
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
5 gtkD is free software; you can redistribute it and/or modify
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
6 it under the terms of the GNU Lesser General Public License as published by
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
7 the Free Software Foundation; either version 2.1 of the License, or
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
8 (at your option) any later version.
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
9
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
10 gtkD is distributed in the hope that it will be useful,
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
13 GNU Lesser General Public License for more details.
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
14
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
15 You should have received a copy of the GNU Lesser General Public License
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
16 along with gtkD; if not, write to the Free Software
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
18
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
19 ******************************************************************************/
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
20
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
21 module dwt.internal.gtk.c.gthreadtypes;
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
22
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
23 public import dwt.internal.gtk.c.glibtypes;
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
24
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
25 /******************************************************************************
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
26
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
27 Possible errors of thread related functions.
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
28 G_THREAD_ERROR_AGAIN
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
29 a thread couldn't be created due to resource
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
30 shortage. Try again later.
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
31
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
32 ******************************************************************************/
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
33
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
34 public enum GThreadError
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
35 {
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
36 AGAIN /+* Resource temporarily unavailable +/
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
37 }
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
38 alias GThreadError ThreadError;
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
39
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
40 /**
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
41 * Specifies the priority of a thread.
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
42 * Note
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
43 * It is not guaranteed that threads with different priorities really
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
44 * behave accordingly. On some systems (e.g. Linux) there are no thread
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
45 * priorities. On other systems (e.g. Solaris) there doesn't seem to be
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
46 * different scheduling for different priorities. All in all try to avoid
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
47 * being dependent on priorities.
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
48 * G_THREAD_PRIORITY_LOW
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
49 * a priority lower than normal
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
50 * G_THREAD_PRIORITY_NORMAL
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
51 * the default priority
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
52 * G_THREAD_PRIORITY_HIGH
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
53 * a priority higher than normal
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
54 * G_THREAD_PRIORITY_URGENT
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
55 * the highest priority
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
56 */
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
57 public enum GThreadPriority
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
58 {
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
59 LOW,
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
60 NORMAL,
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
61 HIGH,
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
62 URGENT
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
63 }
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
64 alias GThreadPriority ThreadPriority;
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
65
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
66 /**
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
67 * The possible statuses of a one-time initialization function controlled by a GOnce struct.
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
68 * G_ONCE_STATUS_NOTCALLED
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
69 * the function has not been called yet.
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
70 * G_ONCE_STATUS_PROGRESS
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
71 * the function call is currently in progress.
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
72 * G_ONCE_STATUS_READY
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
73 * the function has been called.
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
74 * Since 2.4
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
75 */
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
76 public enum GOnceStatus
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
77 {
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
78 NOTCALLED,
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
79 PROGRESS,
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
80 READY
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
81 }
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
82 alias GOnceStatus OnceStatus;
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
83
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
84
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
85 /**
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
86 * This function table is used by g_thread_init() to initialize the
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
87 * thread system. The functions in the table are directly used by their
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
88 * g_* prepended counterparts (described in this document). For example,
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
89 * if you call g_mutex_new() then mutex_new() from the table provided to
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
90 * g_thread_init() will be called.
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
91 * Note
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
92 * Do not use this struct unless you know what you are doing.
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
93 */
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
94 public struct GThreadFunctions{}
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
95 // GMutex* (*mutexNew) (void);
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
96 //
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
97 // void (*mutexLock) (GMutex *mutex);
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
98 //
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
99 // int (*mutexTrylock) (GMutex *mutex);
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
100 //
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
101 // void (*mutexUnlock) (GMutex *mutex);
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
102 //
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
103 // void (*mutexFree) (GMutex *mutex);
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
104 //
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
105 // GCond* (*condNew) (void);
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
106 //
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
107 // void (*condSignal) (GCond *cond);
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
108 //
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
109 // void (*condBroadcast) (GCond *cond);
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
110 //
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
111 // void (*condWait) (GCond *cond,
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
112 //
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
113 // GMutex *mutex);
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
114 //
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
115 // int (*condTimedWait) (GCond *cond,
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
116 //
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
117 // GMutex *mutex,
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
118 //
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
119 // GTimeVal *endTime);
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
120 //
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
121 // void (*condFree) (GCond *cond);
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
122 //
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
123 // GPrivate* (*privateNew) (GDestroyNotify destructor);
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
124 //
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
125 // void* (*privateGet) (GPrivate *privateKey);
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
126 //
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
127 // void (*privateSet) (GPrivate *privateKey,
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
128 //
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
129 // void* data);
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
130 //
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
131 // void (*threadCreate) (GThreadFunc func,
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
132 //
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
133 // void* data,
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
134 //
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
135 // uint stackSize,
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
136 //
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
137 // int joinable,
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
138 //
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
139 // int bound,
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
140 //
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
141 // GThreadPriority priority,
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
142 //
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
143 // void* thread,
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
144 //
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
145 // GError **error);
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
146 //
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
147 // void (*threadYield) (void);
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
148 //
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
149 // void (*threadJoin) (void* thread);
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
150 //
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
151 // void (*threadExit) (void);
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
152 //
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
153 // void (*threadSetPriority)(void* thread,
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
154 //
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
155 // GThreadPriority priority);
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
156 //
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
157 // void (*threadSelf) (void* thread);
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
158 //
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
159 // int (*threadEqual) (void* thread1,
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
160 //
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
161 // void* thread2);
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
162 //
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
163
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
164
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
165 /**
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
166 * Main Gtk struct.
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
167 * The GThread struct represents a running thread. It has three public
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
168 * read-only members, but the underlying struct is bigger, so you must
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
169 * not copy this struct.
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
170 * Note
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
171 * Resources for a joinable thread are not fully released until
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
172 * g_thread_join() is called for that thread.
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
173 */
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
174 public struct GThread{}
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
175
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
176
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
177 /**
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
178 * The GMutex struct is an opaque data structure to represent a mutex
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
179 * (mutual exclusion). It can be used to protect data against shared
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
180 * access. Take for example the following function:
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
181 * Example2.A function which will not work in a threaded environment
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
182 */
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
183 public struct GMutex{}
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
184
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
185
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
186 /**
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
187 * A GStaticMutex works like a GMutex, but it has one significant
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
188 * advantage. It doesn't need to be created at run-time like a GMutex,
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
189 * but can be defined at compile-time. Here is a shorter, easier and
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
190 * safer version of our give_me_next_number() example:
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
191 * Example5.Using GStaticMutex to simplify thread-safe programming
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
192 */
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
193 public struct GStaticMutex{}
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
194
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
195
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
196 /**
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
197 * A GStaticRecMutex works like a GStaticMutex, but it can be locked
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
198 * multiple times by one thread. If you enter it n times, you have to
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
199 * unlock it n times again to let other threads lock it. An exception is
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
200 * the function g_static_rec_mutex_unlock_full(): that allows you to
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
201 * unlock a GStaticRecMutex completely returning the depth, (i.e. the
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
202 * number of times this mutex was locked). The depth can later be used to
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
203 * restore the state of the GStaticRecMutex by calling
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
204 * g_static_rec_mutex_lock_full().
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
205 * Even though GStaticRecMutex is not opaque, it should only be used with
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
206 * the following functions.
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
207 * All of the g_static_rec_mutex_* functions can be
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
208 * used even if g_thread_init() has not been called. Then they do
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
209 * nothing, apart from g_static_rec_mutex_trylock,
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
210 * which does nothing but returning TRUE.
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
211 */
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
212 public struct GStaticRecMutex{}
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
213
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
214
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
215 /**
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
216 * The GStaticRWLock struct represents a read-write lock. A read-write
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
217 * lock can be used for protecting data that some portions of code only
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
218 * read from, while others also write. In such situations it is
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
219 * desirable that several readers can read at once, whereas of course
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
220 * only one writer may write at a time. Take a look at the following
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
221 * example:
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
222 * Example7.An array with access functions
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
223 */
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
224 public struct GStaticRWLock{}
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
225
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
226
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
227 /**
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
228 * The GCond struct is an opaque data structure that represents a
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
229 * condition. Threads can block on a GCond if they find a certain
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
230 * condition to be false. If other threads change the state of this
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
231 * condition they signal the GCond, and that causes the waiting threads
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
232 * to be woken up.
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
233 * Example8.Using GCond to block a thread until a condition is satisfied
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
234 * GCond* data_cond = NULL; /+* Must be initialized somewhere +/
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
235 * GMutex* data_mutex = NULL; /+* Must be initialized somewhere +/
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
236 * gpointer current_data = NULL;
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
237 * void push_data (gpointer data)
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
238 * {
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
239 */
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
240 public struct GCond{}
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
241
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
242
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
243 /**
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
244 * The GPrivate struct is an opaque data structure to represent a thread
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
245 * private data key. Threads can thereby obtain and set a pointer which
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
246 * is private to the current thread.
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
247 * Take our give_me_next_number() example from above.
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
248 * Suppose we don't want current_number to be shared
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
249 * between the threads, but instead to be private to each thread. This can be
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
250 * done as follows:
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
251 * Example9.Using GPrivate for per-thread data
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
252 */
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
253 public struct GPrivate{}
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
254
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
255
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
256 /**
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
257 * A GStaticPrivate works almost like a GPrivate, but it has one
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
258 * significant advantage. It doesn't need to be created at run-time like
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
259 * a GPrivate, but can be defined at compile-time. This is similar to
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
260 * the difference between GMutex and GStaticMutex. Now look at our
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
261 * give_me_next_number() example with ""
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
262 * Example10.Using GStaticPrivate for per-thread data
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
263 */
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
264 public struct GStaticPrivate{}
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
265
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
266
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
267 /**
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
268 * A GOnce struct controls a one-time initialization
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
269 * function. Any one-time initialization function must have its own unique
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
270 * GOnce struct.
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
271 * volatileGOnceStatusstatus;
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
272 * the status of the GOnce
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
273 * volatilegpointerretval;
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
274 * the value returned by the call to the function, if status
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
275 */
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
276 public struct GOnce
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
277 {
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
278 GOnceStatus status;
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
279 void* retval;
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
280 }
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
281
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
282
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
283 /*
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
284 * The G_LOCK_* macros provide a convenient interface to GStaticMutex
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
285 * with the advantage that they will expand to nothing in programs
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
286 * compiled against a thread-disabled GLib, saving code and memory
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
287 * there. G_LOCK_DEFINE defines a lock. It can appear anywhere variable
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
288 * definitions may appear in programs, i.e. in the first block of a
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
289 * function or outside of functions. The name parameter will be mangled
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
290 * to get the name of the GStaticMutex. This means that you can use
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
291 * names of existing variables as the parameter - e.g. the name of the
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
292 * variable you intent to protect with the lock. Look at our
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
293 * give_me_next_number() example using the G_LOCK_* macros:
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
294 * Example6.Using the G_LOCK_* convenience macros
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
295 * G_LOCK_DEFINE (current_number);
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
296 * int give_me_next_number ()
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
297 * {
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
298 * static int current_number = 0;
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
299 * int ret_val;
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
300 * G_LOCK (current_number);
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
301 * ret_val = current_number = calc_next_number (current_number);
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
302 * G_UNLOCK (current_number);
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
303 * return ret_val;
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
304 * }
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
305 * name:
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
306 * the name of the lock.
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
307 */
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
308 // TODO
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
309 // #define G_LOCK_DEFINE(name)
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
310
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
311 /*
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
312 * This works like G_LOCK_DEFINE, but it creates a static object.
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
313 * name:
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
314 * the name of the lock.
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
315 */
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
316 // TODO
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
317 // #define G_LOCK_DEFINE_STATIC(name)
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
318
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
319 /*
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
320 * This declares a lock, that is defined with G_LOCK_DEFINE in another module.
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
321 * name:
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
322 * the name of the lock.
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
323 */
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
324 // TODO
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
325 // #define G_LOCK_EXTERN(name)
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
326
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
327 /*
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
328 * Works like g_mutex_lock(), but for a lock defined with G_LOCK_DEFINE.
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
329 * name:
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
330 * the name of the lock.
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
331 */
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
332 // TODO
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
333 // #define G_LOCK(name)
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
334
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
335 /*
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
336 * Works like g_mutex_trylock(), but for a lock defined with G_LOCK_DEFINE.
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
337 * name:
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
338 * the name of the lock.
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
339 * Returns:
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
340 * TRUE, if the lock could be locked.
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
341 */
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
342 // TODO
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
343 // #define G_TRYLOCK(name)
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
344
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
345 /*
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
346 * Works like g_mutex_unlock(), but for a lock defined with G_LOCK_DEFINE.
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
347 * name:
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
348 * the name of the lock.
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
349 */
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
350 // TODO
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
351 // #define G_UNLOCK(name)
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
352
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
353 /*
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
354 * The first call to this routine by a process with a given GOnce struct calls
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
355 * func with the given argument. Thereafter, subsequent calls to g_once() with
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
356 * the same GOnce struct do not call func again, but return the stored result
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
357 * of the first call. On return from g_once(), the status of once will be
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
358 * G_ONCE_STATUS_READY.
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
359 * For example, a mutex or a thread-specific data key must be created exactly
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
360 * once. In a threaded environment, calling g_once() ensures that the
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
361 * initialization is serialized across multiple threads.
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
362 * Note
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
363 * Calling g_once() recursively on the same GOnce struct in func will lead
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
364 * to a deadlock.
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
365 * gpointer
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
366 * get_debug_flags ()
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
367 * {
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
368 * static GOnce my_once = G_ONCE_INIT;
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
369 * g_once (my_once, parse_debug_flags, NULL);
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
370 * return my_once.retval;
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
371 * }
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
372 * once:
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
373 * a GOnce structure
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
374 * func:
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
375 * the GThreadFunc function associated to once. This function is
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
376 * called only once, regardless of the number of times it and its
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
377 * associated GOnce struct are passed to g_once() .
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
378 * arg:
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
379 * data to be passed to func
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
380 * Since 2.4
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
381 */
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
382 // TODO
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
383 // #define g_once(once, func, arg)
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
384
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
385 /*
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
386 * Specifies the type of the func functions passed to
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
387 * g_thread_create() or g_thread_create_full().
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
388 * data:
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
389 * data passed to the thread.
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
390 * Returns:
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
391 * the return value of the thread, which will be returned by
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
392 * g_thread_join().
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
393 */
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
394 // gpointer (*GThreadFunc) (gpointer data);
5f725d09c076 Added dynamic loader from gtkd with cleanup and modifications. Tango only support. No OS.d tie-in yet.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
395 public typedef extern(C) void* function (void*) GThreadFunc;