Add an mmap() wrapper called GMappedFile. (#148218, David Schleef, Behdad
[platform/upstream/glib.git] / glib / gmain.h
index a8ce3e2..2bbf607 100644 (file)
@@ -32,7 +32,9 @@ typedef struct _GSourceCallbackFuncs  GSourceCallbackFuncs;
 typedef struct _GSourceFuncs           GSourceFuncs;
 
 typedef gboolean (*GSourceFunc)       (gpointer data);
-
+typedef void     (*GChildWatchFunc)   (GPid     pid,
+                                      gint     status,
+                                      gpointer data);
 struct _GSource
 {
   /*< private >*/
@@ -46,12 +48,15 @@ struct _GSource
 
   gint priority;
   guint flags;
-  guint id;
+  guint source_id;
 
   GSList *poll_fds;
   
   GSource *prev;
   GSource *next;
+
+  gpointer reserved1;
+  gpointer reserved2;
 };
 
 struct _GSourceCallbackFuncs
@@ -59,19 +64,26 @@ struct _GSourceCallbackFuncs
   void (*ref)   (gpointer     cb_data);
   void (*unref) (gpointer     cb_data);
   void (*get)   (gpointer     cb_data,
+                GSource     *source, 
                 GSourceFunc *func,
                 gpointer    *data);
 };
 
+typedef void (*GSourceDummyMarshal) (void);
+
 struct _GSourceFuncs
 {
   gboolean (*prepare)  (GSource    *source,
-                       gint       *timeout);
+                       gint       *timeout_);
   gboolean (*check)    (GSource    *source);
   gboolean (*dispatch) (GSource    *source,
                        GSourceFunc callback,
                        gpointer    user_data);
-  void     (*destroy)  (GSource    *source); /* Can be NULL */
+  void     (*finalize) (GSource    *source); /* Can be NULL */
+
+  /* For use by g_source_set_closure */
+  GSourceFunc     closure_callback;       
+  GSourceDummyMarshal closure_marshal; /* Really is of type GClosureMarshal */
 };
 
 /* Any definitions using GPollFD or GPollFunc are primarily
@@ -90,8 +102,7 @@ struct _GSourceFuncs
  * WSAEventSelect to signal events when a SOCKET is readable).
  *
  * On Win32, fd can also be the special value G_WIN32_MSG_HANDLE to
- * indicate polling for messages. These message queue GPollFDs should
- * be added with the g_main_poll_win32_msg_add function.
+ * indicate polling for messages.
  *
  * But note that G_WIN32_MSG_HANDLE GPollFDs should not be used by GDK
  * (GTK) programs, as GDK itself wants to read messages and convert them
@@ -105,7 +116,7 @@ struct _GSourceFuncs
 typedef struct _GPollFD GPollFD;
 typedef gint   (*GPollFunc)    (GPollFD *ufds,
                                 guint    nfsd,
-                                gint     timeout);
+                                gint     timeout_);
 
 struct _GPollFD
 {
@@ -124,7 +135,9 @@ struct _GPollFD
 
 /* GMainContext: */
 
-GMainContext *g_main_context_get       (GThread      *thread);
+GMainContext *g_main_context_new       (void);
+GMainContext *g_main_context_ref       (GMainContext *context);
+void          g_main_context_unref     (GMainContext *context);
 GMainContext *g_main_context_default   (void);
 
 gboolean      g_main_context_iteration (GMainContext *context,
@@ -134,7 +147,7 @@ gboolean      g_main_context_pending   (GMainContext *context);
 /* For implementation of legacy interfaces
  */
 GSource      *g_main_context_find_source_by_id              (GMainContext *context,
-                                                            guint         id);
+                                                            guint         source_id);
 GSource      *g_main_context_find_source_by_user_data       (GMainContext *context,
                                                             gpointer      user_data);
 GSource      *g_main_context_find_source_by_funcs_user_data (GMainContext *context,
@@ -143,11 +156,18 @@ GSource      *g_main_context_find_source_by_funcs_user_data (GMainContext *conte
 
 /* Low level functions for implementing custom main loops.
  */
+void     g_main_context_wakeup  (GMainContext *context);
+gboolean g_main_context_acquire (GMainContext *context);
+void     g_main_context_release (GMainContext *context);
+gboolean g_main_context_wait    (GMainContext *context,
+                                GCond        *cond,
+                                GMutex       *mutex);
+
 gboolean g_main_context_prepare  (GMainContext *context,
                                  gint         *priority);
 gint     g_main_context_query    (GMainContext *context,
                                  gint          max_priority,
-                                 gint         *timeout,
+                                 gint         *timeout_,
                                  GPollFD      *fds,
                                  gint          n_fds);
 gint     g_main_context_check    (GMainContext *context,
@@ -168,6 +188,8 @@ void g_main_context_add_poll      (GMainContext *context,
 void g_main_context_remove_poll   (GMainContext *context,
                                   GPollFD      *fd);
 
+int g_main_depth (void);
+
 /* GMainLoop: */
 
 GMainLoop *g_main_loop_new        (GMainContext *context,
@@ -177,6 +199,7 @@ void       g_main_loop_quit       (GMainLoop    *loop);
 GMainLoop *g_main_loop_ref        (GMainLoop    *loop);
 void       g_main_loop_unref      (GMainLoop    *loop);
 gboolean   g_main_loop_is_running (GMainLoop    *loop);
+GMainContext *g_main_loop_get_context (GMainLoop    *loop);
 
 /* GSource: */
 
@@ -224,8 +247,9 @@ void     g_source_get_current_time (GSource        *source,
 
 /* Specific source types
  */
-GSource *g_idle_source_new    (void);
-GSource *g_timeout_source_new (guint         interval);
+GSource *g_idle_source_new        (void);
+GSource *g_child_watch_source_new (GPid pid);
+GSource *g_timeout_source_new     (guint interval);
 
 /* Miscellaneous functions
  */
@@ -259,32 +283,35 @@ gboolean g_source_remove_by_user_data        (gpointer       user_data);
 gboolean g_source_remove_by_funcs_user_data  (GSourceFuncs  *funcs,
                                              gpointer       user_data);
 
-/* Idles and timeouts */
-guint          g_timeout_add_full      (gint           priority,
-                                        guint          interval, 
-                                        GSourceFunc    function,
-                                        gpointer       data,
-                                        GDestroyNotify notify);
-guint          g_timeout_add           (guint          interval,
-                                        GSourceFunc    function,
-                                        gpointer       data);
-guint          g_idle_add              (GSourceFunc    function,
-                                        gpointer       data);
-guint          g_idle_add_full         (gint           priority,
-                                        GSourceFunc    function,
-                                        gpointer       data,
-                                        GDestroyNotify notify);
-gboolean       g_idle_remove_by_data   (gpointer       data);
-
-#ifdef G_OS_WIN32
-
-/* This is used to add polling for Windows messages. GDK (GTK+) programs
- * should *not* use this.
- */
-void        g_main_poll_win32_msg_add (gint        priority,
-                                      GPollFD    *fd,
-                                      guint       hwnd);
-#endif /* G_OS_WIN32 */
+/* Idles, child watchers and timeouts */
+guint    g_timeout_add_full     (gint            priority,
+                                guint           interval,
+                                GSourceFunc     function,
+                                gpointer        data,
+                                GDestroyNotify  notify);
+guint    g_timeout_add          (guint           interval,
+                                GSourceFunc     function,
+                                gpointer        data);
+guint    g_child_watch_add_full (gint            priority,
+                                GPid            pid,
+                                GChildWatchFunc function,
+                                gpointer        data,
+                                GDestroyNotify  notify);
+guint    g_child_watch_add      (GPid            pid,
+                                GChildWatchFunc function,
+                                gpointer        data);
+guint    g_idle_add             (GSourceFunc     function,
+                                gpointer        data);
+guint    g_idle_add_full        (gint            priority,
+                                GSourceFunc     function,
+                                gpointer        data,
+                                GDestroyNotify  notify);
+gboolean g_idle_remove_by_data  (gpointer        data);
+
+/* Hook for GClosure / GSource integration. Don't touch */
+GLIB_VAR GSourceFuncs g_timeout_funcs;
+GLIB_VAR GSourceFuncs g_child_watch_funcs;
+GLIB_VAR GSourceFuncs g_idle_funcs;
 
 G_END_DECLS