mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-21 08:28:53 +02:00
if !G_THREADS_ENABLED, eat the trailing semicolon with a bogus function
Thu Dec 17 04:10:49 1998 Tim Janik <timj@gtk.org> * glib.h (G_LOCK_DECLARE_*): if !G_THREADS_ENABLED, eat the trailing semicolon with a bogus function declaration, instead of with a bogus variable declarations, so we avoid unused variable warnings.
This commit is contained in:
@@ -1,3 +1,10 @@
|
|||||||
|
Thu Dec 17 04:10:49 1998 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* glib.h (G_LOCK_DECLARE_*): if !G_THREADS_ENABLED, eat the
|
||||||
|
trailing semicolon with a bogus function declaration, instead
|
||||||
|
of with a bogus variable declarations, so we avoid unused
|
||||||
|
variable warnings.
|
||||||
|
|
||||||
Wed Dec 16 07:49:16 PST 1998 Shawn T. Amundson <amundson@gtk.org>
|
Wed Dec 16 07:49:16 PST 1998 Shawn T. Amundson <amundson@gtk.org>
|
||||||
|
|
||||||
* Released GLib 1.1.8 (CVS tag is GLIB_1_1_8a)
|
* Released GLib 1.1.8 (CVS tag is GLIB_1_1_8a)
|
||||||
|
@@ -1,3 +1,10 @@
|
|||||||
|
Thu Dec 17 04:10:49 1998 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* glib.h (G_LOCK_DECLARE_*): if !G_THREADS_ENABLED, eat the
|
||||||
|
trailing semicolon with a bogus function declaration, instead
|
||||||
|
of with a bogus variable declarations, so we avoid unused
|
||||||
|
variable warnings.
|
||||||
|
|
||||||
Wed Dec 16 07:49:16 PST 1998 Shawn T. Amundson <amundson@gtk.org>
|
Wed Dec 16 07:49:16 PST 1998 Shawn T. Amundson <amundson@gtk.org>
|
||||||
|
|
||||||
* Released GLib 1.1.8 (CVS tag is GLIB_1_1_8a)
|
* Released GLib 1.1.8 (CVS tag is GLIB_1_1_8a)
|
||||||
|
@@ -1,3 +1,10 @@
|
|||||||
|
Thu Dec 17 04:10:49 1998 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* glib.h (G_LOCK_DECLARE_*): if !G_THREADS_ENABLED, eat the
|
||||||
|
trailing semicolon with a bogus function declaration, instead
|
||||||
|
of with a bogus variable declarations, so we avoid unused
|
||||||
|
variable warnings.
|
||||||
|
|
||||||
Wed Dec 16 07:49:16 PST 1998 Shawn T. Amundson <amundson@gtk.org>
|
Wed Dec 16 07:49:16 PST 1998 Shawn T. Amundson <amundson@gtk.org>
|
||||||
|
|
||||||
* Released GLib 1.1.8 (CVS tag is GLIB_1_1_8a)
|
* Released GLib 1.1.8 (CVS tag is GLIB_1_1_8a)
|
||||||
|
@@ -1,3 +1,10 @@
|
|||||||
|
Thu Dec 17 04:10:49 1998 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* glib.h (G_LOCK_DECLARE_*): if !G_THREADS_ENABLED, eat the
|
||||||
|
trailing semicolon with a bogus function declaration, instead
|
||||||
|
of with a bogus variable declarations, so we avoid unused
|
||||||
|
variable warnings.
|
||||||
|
|
||||||
Wed Dec 16 07:49:16 PST 1998 Shawn T. Amundson <amundson@gtk.org>
|
Wed Dec 16 07:49:16 PST 1998 Shawn T. Amundson <amundson@gtk.org>
|
||||||
|
|
||||||
* Released GLib 1.1.8 (CVS tag is GLIB_1_1_8a)
|
* Released GLib 1.1.8 (CVS tag is GLIB_1_1_8a)
|
||||||
|
@@ -1,3 +1,10 @@
|
|||||||
|
Thu Dec 17 04:10:49 1998 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* glib.h (G_LOCK_DECLARE_*): if !G_THREADS_ENABLED, eat the
|
||||||
|
trailing semicolon with a bogus function declaration, instead
|
||||||
|
of with a bogus variable declarations, so we avoid unused
|
||||||
|
variable warnings.
|
||||||
|
|
||||||
Wed Dec 16 07:49:16 PST 1998 Shawn T. Amundson <amundson@gtk.org>
|
Wed Dec 16 07:49:16 PST 1998 Shawn T. Amundson <amundson@gtk.org>
|
||||||
|
|
||||||
* Released GLib 1.1.8 (CVS tag is GLIB_1_1_8a)
|
* Released GLib 1.1.8 (CVS tag is GLIB_1_1_8a)
|
||||||
|
@@ -1,3 +1,10 @@
|
|||||||
|
Thu Dec 17 04:10:49 1998 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* glib.h (G_LOCK_DECLARE_*): if !G_THREADS_ENABLED, eat the
|
||||||
|
trailing semicolon with a bogus function declaration, instead
|
||||||
|
of with a bogus variable declarations, so we avoid unused
|
||||||
|
variable warnings.
|
||||||
|
|
||||||
Wed Dec 16 07:49:16 PST 1998 Shawn T. Amundson <amundson@gtk.org>
|
Wed Dec 16 07:49:16 PST 1998 Shawn T. Amundson <amundson@gtk.org>
|
||||||
|
|
||||||
* Released GLib 1.1.8 (CVS tag is GLIB_1_1_8a)
|
* Released GLib 1.1.8 (CVS tag is GLIB_1_1_8a)
|
||||||
|
@@ -1,3 +1,10 @@
|
|||||||
|
Thu Dec 17 04:10:49 1998 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* glib.h (G_LOCK_DECLARE_*): if !G_THREADS_ENABLED, eat the
|
||||||
|
trailing semicolon with a bogus function declaration, instead
|
||||||
|
of with a bogus variable declarations, so we avoid unused
|
||||||
|
variable warnings.
|
||||||
|
|
||||||
Wed Dec 16 07:49:16 PST 1998 Shawn T. Amundson <amundson@gtk.org>
|
Wed Dec 16 07:49:16 PST 1998 Shawn T. Amundson <amundson@gtk.org>
|
||||||
|
|
||||||
* Released GLib 1.1.8 (CVS tag is GLIB_1_1_8a)
|
* Released GLib 1.1.8 (CVS tag is GLIB_1_1_8a)
|
||||||
|
@@ -1,3 +1,10 @@
|
|||||||
|
Thu Dec 17 04:10:49 1998 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* glib.h (G_LOCK_DECLARE_*): if !G_THREADS_ENABLED, eat the
|
||||||
|
trailing semicolon with a bogus function declaration, instead
|
||||||
|
of with a bogus variable declarations, so we avoid unused
|
||||||
|
variable warnings.
|
||||||
|
|
||||||
Wed Dec 16 07:49:16 PST 1998 Shawn T. Amundson <amundson@gtk.org>
|
Wed Dec 16 07:49:16 PST 1998 Shawn T. Amundson <amundson@gtk.org>
|
||||||
|
|
||||||
* Released GLib 1.1.8 (CVS tag is GLIB_1_1_8a)
|
* Released GLib 1.1.8 (CVS tag is GLIB_1_1_8a)
|
||||||
|
6
glib.h
6
glib.h
@@ -2678,7 +2678,7 @@ void g_static_private_set (GStaticPrivate *private_key,
|
|||||||
* such mutexes can be done with G_LOCK(), G_UNLOCK() and G_TRYLOCK()
|
* such mutexes can be done with G_LOCK(), G_UNLOCK() and G_TRYLOCK()
|
||||||
* respectively.
|
* respectively.
|
||||||
*/
|
*/
|
||||||
extern gboolean glib_dummy_decl;
|
extern void glib_dummy_decl (void);
|
||||||
#define G_LOCK_NAME(name) (g__ ## name ## _lock)
|
#define G_LOCK_NAME(name) (g__ ## name ## _lock)
|
||||||
#ifdef G_THREADS_ENABLED
|
#ifdef G_THREADS_ENABLED
|
||||||
# define G_LOCK_DECLARE_STATIC(name) static G_LOCK_DECLARE (name)
|
# define G_LOCK_DECLARE_STATIC(name) static G_LOCK_DECLARE (name)
|
||||||
@@ -2712,8 +2712,8 @@ extern gboolean glib_dummy_decl;
|
|||||||
# define G_TRYLOCK(name) g_static_mutex_trylock (G_LOCK_NAME (name))
|
# define G_TRYLOCK(name) g_static_mutex_trylock (G_LOCK_NAME (name))
|
||||||
# endif /* !G_DEBUG_LOCKS */
|
# endif /* !G_DEBUG_LOCKS */
|
||||||
#else /* !G_THREADS_ENABLED */
|
#else /* !G_THREADS_ENABLED */
|
||||||
# define G_LOCK_DECLARE_STATIC(name) extern gboolean glib_dummy_decl
|
# define G_LOCK_DECLARE_STATIC(name) extern void glib_dummy_decl (void)
|
||||||
# define G_LOCK_DECLARE(name) extern gboolean glib_dummy_decl
|
# define G_LOCK_DECLARE(name) extern void glib_dummy_decl (void)
|
||||||
# define G_LOCK(name)
|
# define G_LOCK(name)
|
||||||
# define G_UNLOCK(name)
|
# define G_UNLOCK(name)
|
||||||
# define G_TRYLOCK(name) (FALSE)
|
# define G_TRYLOCK(name) (FALSE)
|
||||||
|
@@ -2678,7 +2678,7 @@ void g_static_private_set (GStaticPrivate *private_key,
|
|||||||
* such mutexes can be done with G_LOCK(), G_UNLOCK() and G_TRYLOCK()
|
* such mutexes can be done with G_LOCK(), G_UNLOCK() and G_TRYLOCK()
|
||||||
* respectively.
|
* respectively.
|
||||||
*/
|
*/
|
||||||
extern gboolean glib_dummy_decl;
|
extern void glib_dummy_decl (void);
|
||||||
#define G_LOCK_NAME(name) (g__ ## name ## _lock)
|
#define G_LOCK_NAME(name) (g__ ## name ## _lock)
|
||||||
#ifdef G_THREADS_ENABLED
|
#ifdef G_THREADS_ENABLED
|
||||||
# define G_LOCK_DECLARE_STATIC(name) static G_LOCK_DECLARE (name)
|
# define G_LOCK_DECLARE_STATIC(name) static G_LOCK_DECLARE (name)
|
||||||
@@ -2712,8 +2712,8 @@ extern gboolean glib_dummy_decl;
|
|||||||
# define G_TRYLOCK(name) g_static_mutex_trylock (G_LOCK_NAME (name))
|
# define G_TRYLOCK(name) g_static_mutex_trylock (G_LOCK_NAME (name))
|
||||||
# endif /* !G_DEBUG_LOCKS */
|
# endif /* !G_DEBUG_LOCKS */
|
||||||
#else /* !G_THREADS_ENABLED */
|
#else /* !G_THREADS_ENABLED */
|
||||||
# define G_LOCK_DECLARE_STATIC(name) extern gboolean glib_dummy_decl
|
# define G_LOCK_DECLARE_STATIC(name) extern void glib_dummy_decl (void)
|
||||||
# define G_LOCK_DECLARE(name) extern gboolean glib_dummy_decl
|
# define G_LOCK_DECLARE(name) extern void glib_dummy_decl (void)
|
||||||
# define G_LOCK(name)
|
# define G_LOCK(name)
|
||||||
# define G_UNLOCK(name)
|
# define G_UNLOCK(name)
|
||||||
# define G_TRYLOCK(name) (FALSE)
|
# define G_TRYLOCK(name) (FALSE)
|
||||||
|
68
glib/gmain.c
68
glib/gmain.c
@@ -37,32 +37,38 @@ typedef struct _GTimeoutData GTimeoutData;
|
|||||||
typedef struct _GSource GSource;
|
typedef struct _GSource GSource;
|
||||||
typedef struct _GPollRec GPollRec;
|
typedef struct _GPollRec GPollRec;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum
|
||||||
|
{
|
||||||
G_SOURCE_READY = 1 << G_HOOK_FLAG_USER_SHIFT,
|
G_SOURCE_READY = 1 << G_HOOK_FLAG_USER_SHIFT,
|
||||||
G_SOURCE_CAN_RECURSE = 1 << (G_HOOK_FLAG_USER_SHIFT + 1)
|
G_SOURCE_CAN_RECURSE = 1 << (G_HOOK_FLAG_USER_SHIFT + 1)
|
||||||
} GSourceFlags;
|
} GSourceFlags;
|
||||||
|
|
||||||
struct _GSource {
|
struct _GSource
|
||||||
|
{
|
||||||
GHook hook;
|
GHook hook;
|
||||||
gint priority;
|
gint priority;
|
||||||
gpointer source_data;
|
gpointer source_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GMainLoop {
|
struct _GMainLoop
|
||||||
|
{
|
||||||
gboolean flag;
|
gboolean flag;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GIdleData {
|
struct _GIdleData
|
||||||
|
{
|
||||||
GSourceFunc callback;
|
GSourceFunc callback;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GTimeoutData {
|
struct _GTimeoutData
|
||||||
|
{
|
||||||
GTimeVal expiration;
|
GTimeVal expiration;
|
||||||
gint interval;
|
gint interval;
|
||||||
GSourceFunc callback;
|
GSourceFunc callback;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GPollRec {
|
struct _GPollRec
|
||||||
|
{
|
||||||
gint priority;
|
gint priority;
|
||||||
GPollFD *fd;
|
GPollFD *fd;
|
||||||
GPollRec *next;
|
GPollRec *next;
|
||||||
@@ -129,8 +135,8 @@ static GPollFD wake_up_rec;
|
|||||||
static gboolean poll_waiting = FALSE;
|
static gboolean poll_waiting = FALSE;
|
||||||
|
|
||||||
#ifdef HAVE_POLL
|
#ifdef HAVE_POLL
|
||||||
static GPollFunc poll_func = (GPollFunc)poll;
|
static GPollFunc poll_func = (GPollFunc) poll;
|
||||||
#else
|
#else /* !HAVE_POLL */
|
||||||
|
|
||||||
/* The following implementation of poll() comes from the GNU C Library.
|
/* The following implementation of poll() comes from the GNU C Library.
|
||||||
* Copyright (C) 1994, 1996, 1997 Free Software Foundation, Inc.
|
* Copyright (C) 1994, 1996, 1997 Free Software Foundation, Inc.
|
||||||
@@ -144,7 +150,7 @@ static GPollFunc poll_func = (GPollFunc)poll;
|
|||||||
|
|
||||||
#ifndef NO_FD_SET
|
#ifndef NO_FD_SET
|
||||||
# define SELECT_MASK fd_set
|
# define SELECT_MASK fd_set
|
||||||
#else
|
#else /* !NO_FD_SET */
|
||||||
# ifndef _AIX
|
# ifndef _AIX
|
||||||
typedef long fd_mask;
|
typedef long fd_mask;
|
||||||
# endif
|
# endif
|
||||||
@@ -153,7 +159,7 @@ typedef long fd_mask;
|
|||||||
# else
|
# else
|
||||||
# define SELECT_MASK int
|
# define SELECT_MASK int
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif /* !NO_FD_SET */
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
g_poll (GPollFD *fds, guint nfds, gint timeout)
|
g_poll (GPollFD *fds, guint nfds, gint timeout)
|
||||||
@@ -203,9 +209,8 @@ g_poll (GPollFD *fds, guint nfds, gint timeout)
|
|||||||
|
|
||||||
return ready;
|
return ready;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GPollFunc poll_func = g_poll;
|
static GPollFunc poll_func = g_poll;
|
||||||
#endif
|
#endif /* !HAVE_POLL */
|
||||||
|
|
||||||
/* Hooks for adding to the main loop */
|
/* Hooks for adding to the main loop */
|
||||||
|
|
||||||
@@ -213,7 +218,8 @@ static GPollFunc poll_func = g_poll;
|
|||||||
* sure we insert at the end of equal priority items
|
* sure we insert at the end of equal priority items
|
||||||
*/
|
*/
|
||||||
static gint
|
static gint
|
||||||
g_source_compare (GHook *a, GHook *b)
|
g_source_compare (GHook *a,
|
||||||
|
GHook *b)
|
||||||
{
|
{
|
||||||
GSource *source_a = (GSource *)a;
|
GSource *source_a = (GSource *)a;
|
||||||
GSource *source_b = (GSource *)b;
|
GSource *source_b = (GSource *)b;
|
||||||
@@ -277,7 +283,8 @@ g_source_remove (guint tag)
|
|||||||
if (hook)
|
if (hook)
|
||||||
{
|
{
|
||||||
GSource *source = (GSource *)hook;
|
GSource *source = (GSource *)hook;
|
||||||
((GSourceFuncs *)source->hook.func)->destroy (source->source_data);
|
|
||||||
|
((GSourceFuncs *) source->hook.func)->destroy (source->source_data);
|
||||||
g_hook_destroy_link (&source_list, hook);
|
g_hook_destroy_link (&source_list, hook);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -295,7 +302,8 @@ g_source_remove_by_user_data (gpointer user_data)
|
|||||||
if (hook)
|
if (hook)
|
||||||
{
|
{
|
||||||
GSource *source = (GSource *)hook;
|
GSource *source = (GSource *)hook;
|
||||||
((GSourceFuncs *)source->hook.func)->destroy (source->source_data);
|
|
||||||
|
((GSourceFuncs *) source->hook.func)->destroy (source->source_data);
|
||||||
g_hook_destroy_link (&source_list, hook);
|
g_hook_destroy_link (&source_list, hook);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,6 +315,7 @@ g_source_find_source_data (GHook *hook,
|
|||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GSource *source = (GSource *)hook;
|
GSource *source = (GSource *)hook;
|
||||||
|
|
||||||
return (source->source_data == data);
|
return (source->source_data == data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -318,20 +327,24 @@ g_source_remove_by_source_data (gpointer source_data)
|
|||||||
G_LOCK (main_loop);
|
G_LOCK (main_loop);
|
||||||
|
|
||||||
hook = g_hook_find (&source_list, TRUE,
|
hook = g_hook_find (&source_list, TRUE,
|
||||||
g_source_find_source_data, source_data);
|
g_source_find_source_data, source_data);
|
||||||
if (hook)
|
if (hook)
|
||||||
{
|
{
|
||||||
GSource *source = (GSource *)hook;
|
GSource *source = (GSource *)hook;
|
||||||
((GSourceFuncs *)source->hook.func)->destroy (source->source_data);
|
|
||||||
|
((GSourceFuncs *) source->hook.func)->destroy (source->source_data);
|
||||||
g_hook_destroy_link (&source_list, hook);
|
g_hook_destroy_link (&source_list, hook);
|
||||||
}
|
}
|
||||||
|
|
||||||
G_UNLOCK (main_loop);
|
G_UNLOCK (main_loop);
|
||||||
}
|
}
|
||||||
|
|
||||||
void g_get_current_time (GTimeVal *result)
|
void
|
||||||
|
g_get_current_time (GTimeVal *result)
|
||||||
{
|
{
|
||||||
gettimeofday ((struct timeval *)result, NULL);
|
g_return_if_fail (result != NULL);
|
||||||
|
|
||||||
|
gettimeofday ((struct timeval *) result, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Running the main loop */
|
/* Running the main loop */
|
||||||
@@ -352,24 +365,26 @@ g_main_dispatch (GTimeVal *current_time)
|
|||||||
|
|
||||||
if (G_HOOK_IS_VALID (source))
|
if (G_HOOK_IS_VALID (source))
|
||||||
{
|
{
|
||||||
gboolean (*dispatch) (gpointer, GTimeVal *, gpointer);
|
|
||||||
gpointer hook_data = source->hook.data;
|
gpointer hook_data = source->hook.data;
|
||||||
gpointer source_data = source->source_data;
|
gpointer source_data = source->source_data;
|
||||||
|
gboolean (*dispatch) (gpointer,
|
||||||
|
GTimeVal *,
|
||||||
|
gpointer);
|
||||||
|
|
||||||
dispatch = ((GSourceFuncs *)source->hook.func)->dispatch;
|
dispatch = ((GSourceFuncs *) source->hook.func)->dispatch;
|
||||||
|
|
||||||
source->hook.flags |= G_HOOK_FLAG_IN_CALL;
|
source->hook.flags |= G_HOOK_FLAG_IN_CALL;
|
||||||
|
|
||||||
G_UNLOCK (main_loop);
|
G_UNLOCK (main_loop);
|
||||||
need_destroy = ! dispatch(source_data,
|
need_destroy = ! dispatch (source_data,
|
||||||
current_time,
|
current_time,
|
||||||
hook_data);
|
hook_data);
|
||||||
G_LOCK (main_loop);
|
G_LOCK (main_loop);
|
||||||
|
|
||||||
source->hook.flags &= ~G_HOOK_FLAG_IN_CALL;
|
source->hook.flags &= ~G_HOOK_FLAG_IN_CALL;
|
||||||
|
|
||||||
if (need_destroy)
|
if (need_destroy)
|
||||||
g_hook_destroy_link (&source_list, (GHook *)source);
|
g_hook_destroy_link (&source_list, (GHook *) source);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_hook_unref (&source_list, (GHook *)source);
|
g_hook_unref (&source_list, (GHook *)source);
|
||||||
@@ -381,7 +396,8 @@ g_main_dispatch (GTimeVal *current_time)
|
|||||||
* run the loop.
|
* run the loop.
|
||||||
*/
|
*/
|
||||||
static gboolean
|
static gboolean
|
||||||
g_main_iterate (gboolean block, gboolean dispatch)
|
g_main_iterate (gboolean block,
|
||||||
|
gboolean dispatch)
|
||||||
{
|
{
|
||||||
GHook *hook;
|
GHook *hook;
|
||||||
GTimeVal current_time;
|
GTimeVal current_time;
|
||||||
|
68
gmain.c
68
gmain.c
@@ -37,32 +37,38 @@ typedef struct _GTimeoutData GTimeoutData;
|
|||||||
typedef struct _GSource GSource;
|
typedef struct _GSource GSource;
|
||||||
typedef struct _GPollRec GPollRec;
|
typedef struct _GPollRec GPollRec;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum
|
||||||
|
{
|
||||||
G_SOURCE_READY = 1 << G_HOOK_FLAG_USER_SHIFT,
|
G_SOURCE_READY = 1 << G_HOOK_FLAG_USER_SHIFT,
|
||||||
G_SOURCE_CAN_RECURSE = 1 << (G_HOOK_FLAG_USER_SHIFT + 1)
|
G_SOURCE_CAN_RECURSE = 1 << (G_HOOK_FLAG_USER_SHIFT + 1)
|
||||||
} GSourceFlags;
|
} GSourceFlags;
|
||||||
|
|
||||||
struct _GSource {
|
struct _GSource
|
||||||
|
{
|
||||||
GHook hook;
|
GHook hook;
|
||||||
gint priority;
|
gint priority;
|
||||||
gpointer source_data;
|
gpointer source_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GMainLoop {
|
struct _GMainLoop
|
||||||
|
{
|
||||||
gboolean flag;
|
gboolean flag;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GIdleData {
|
struct _GIdleData
|
||||||
|
{
|
||||||
GSourceFunc callback;
|
GSourceFunc callback;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GTimeoutData {
|
struct _GTimeoutData
|
||||||
|
{
|
||||||
GTimeVal expiration;
|
GTimeVal expiration;
|
||||||
gint interval;
|
gint interval;
|
||||||
GSourceFunc callback;
|
GSourceFunc callback;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GPollRec {
|
struct _GPollRec
|
||||||
|
{
|
||||||
gint priority;
|
gint priority;
|
||||||
GPollFD *fd;
|
GPollFD *fd;
|
||||||
GPollRec *next;
|
GPollRec *next;
|
||||||
@@ -129,8 +135,8 @@ static GPollFD wake_up_rec;
|
|||||||
static gboolean poll_waiting = FALSE;
|
static gboolean poll_waiting = FALSE;
|
||||||
|
|
||||||
#ifdef HAVE_POLL
|
#ifdef HAVE_POLL
|
||||||
static GPollFunc poll_func = (GPollFunc)poll;
|
static GPollFunc poll_func = (GPollFunc) poll;
|
||||||
#else
|
#else /* !HAVE_POLL */
|
||||||
|
|
||||||
/* The following implementation of poll() comes from the GNU C Library.
|
/* The following implementation of poll() comes from the GNU C Library.
|
||||||
* Copyright (C) 1994, 1996, 1997 Free Software Foundation, Inc.
|
* Copyright (C) 1994, 1996, 1997 Free Software Foundation, Inc.
|
||||||
@@ -144,7 +150,7 @@ static GPollFunc poll_func = (GPollFunc)poll;
|
|||||||
|
|
||||||
#ifndef NO_FD_SET
|
#ifndef NO_FD_SET
|
||||||
# define SELECT_MASK fd_set
|
# define SELECT_MASK fd_set
|
||||||
#else
|
#else /* !NO_FD_SET */
|
||||||
# ifndef _AIX
|
# ifndef _AIX
|
||||||
typedef long fd_mask;
|
typedef long fd_mask;
|
||||||
# endif
|
# endif
|
||||||
@@ -153,7 +159,7 @@ typedef long fd_mask;
|
|||||||
# else
|
# else
|
||||||
# define SELECT_MASK int
|
# define SELECT_MASK int
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif /* !NO_FD_SET */
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
g_poll (GPollFD *fds, guint nfds, gint timeout)
|
g_poll (GPollFD *fds, guint nfds, gint timeout)
|
||||||
@@ -203,9 +209,8 @@ g_poll (GPollFD *fds, guint nfds, gint timeout)
|
|||||||
|
|
||||||
return ready;
|
return ready;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GPollFunc poll_func = g_poll;
|
static GPollFunc poll_func = g_poll;
|
||||||
#endif
|
#endif /* !HAVE_POLL */
|
||||||
|
|
||||||
/* Hooks for adding to the main loop */
|
/* Hooks for adding to the main loop */
|
||||||
|
|
||||||
@@ -213,7 +218,8 @@ static GPollFunc poll_func = g_poll;
|
|||||||
* sure we insert at the end of equal priority items
|
* sure we insert at the end of equal priority items
|
||||||
*/
|
*/
|
||||||
static gint
|
static gint
|
||||||
g_source_compare (GHook *a, GHook *b)
|
g_source_compare (GHook *a,
|
||||||
|
GHook *b)
|
||||||
{
|
{
|
||||||
GSource *source_a = (GSource *)a;
|
GSource *source_a = (GSource *)a;
|
||||||
GSource *source_b = (GSource *)b;
|
GSource *source_b = (GSource *)b;
|
||||||
@@ -277,7 +283,8 @@ g_source_remove (guint tag)
|
|||||||
if (hook)
|
if (hook)
|
||||||
{
|
{
|
||||||
GSource *source = (GSource *)hook;
|
GSource *source = (GSource *)hook;
|
||||||
((GSourceFuncs *)source->hook.func)->destroy (source->source_data);
|
|
||||||
|
((GSourceFuncs *) source->hook.func)->destroy (source->source_data);
|
||||||
g_hook_destroy_link (&source_list, hook);
|
g_hook_destroy_link (&source_list, hook);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -295,7 +302,8 @@ g_source_remove_by_user_data (gpointer user_data)
|
|||||||
if (hook)
|
if (hook)
|
||||||
{
|
{
|
||||||
GSource *source = (GSource *)hook;
|
GSource *source = (GSource *)hook;
|
||||||
((GSourceFuncs *)source->hook.func)->destroy (source->source_data);
|
|
||||||
|
((GSourceFuncs *) source->hook.func)->destroy (source->source_data);
|
||||||
g_hook_destroy_link (&source_list, hook);
|
g_hook_destroy_link (&source_list, hook);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,6 +315,7 @@ g_source_find_source_data (GHook *hook,
|
|||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GSource *source = (GSource *)hook;
|
GSource *source = (GSource *)hook;
|
||||||
|
|
||||||
return (source->source_data == data);
|
return (source->source_data == data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -318,20 +327,24 @@ g_source_remove_by_source_data (gpointer source_data)
|
|||||||
G_LOCK (main_loop);
|
G_LOCK (main_loop);
|
||||||
|
|
||||||
hook = g_hook_find (&source_list, TRUE,
|
hook = g_hook_find (&source_list, TRUE,
|
||||||
g_source_find_source_data, source_data);
|
g_source_find_source_data, source_data);
|
||||||
if (hook)
|
if (hook)
|
||||||
{
|
{
|
||||||
GSource *source = (GSource *)hook;
|
GSource *source = (GSource *)hook;
|
||||||
((GSourceFuncs *)source->hook.func)->destroy (source->source_data);
|
|
||||||
|
((GSourceFuncs *) source->hook.func)->destroy (source->source_data);
|
||||||
g_hook_destroy_link (&source_list, hook);
|
g_hook_destroy_link (&source_list, hook);
|
||||||
}
|
}
|
||||||
|
|
||||||
G_UNLOCK (main_loop);
|
G_UNLOCK (main_loop);
|
||||||
}
|
}
|
||||||
|
|
||||||
void g_get_current_time (GTimeVal *result)
|
void
|
||||||
|
g_get_current_time (GTimeVal *result)
|
||||||
{
|
{
|
||||||
gettimeofday ((struct timeval *)result, NULL);
|
g_return_if_fail (result != NULL);
|
||||||
|
|
||||||
|
gettimeofday ((struct timeval *) result, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Running the main loop */
|
/* Running the main loop */
|
||||||
@@ -352,24 +365,26 @@ g_main_dispatch (GTimeVal *current_time)
|
|||||||
|
|
||||||
if (G_HOOK_IS_VALID (source))
|
if (G_HOOK_IS_VALID (source))
|
||||||
{
|
{
|
||||||
gboolean (*dispatch) (gpointer, GTimeVal *, gpointer);
|
|
||||||
gpointer hook_data = source->hook.data;
|
gpointer hook_data = source->hook.data;
|
||||||
gpointer source_data = source->source_data;
|
gpointer source_data = source->source_data;
|
||||||
|
gboolean (*dispatch) (gpointer,
|
||||||
|
GTimeVal *,
|
||||||
|
gpointer);
|
||||||
|
|
||||||
dispatch = ((GSourceFuncs *)source->hook.func)->dispatch;
|
dispatch = ((GSourceFuncs *) source->hook.func)->dispatch;
|
||||||
|
|
||||||
source->hook.flags |= G_HOOK_FLAG_IN_CALL;
|
source->hook.flags |= G_HOOK_FLAG_IN_CALL;
|
||||||
|
|
||||||
G_UNLOCK (main_loop);
|
G_UNLOCK (main_loop);
|
||||||
need_destroy = ! dispatch(source_data,
|
need_destroy = ! dispatch (source_data,
|
||||||
current_time,
|
current_time,
|
||||||
hook_data);
|
hook_data);
|
||||||
G_LOCK (main_loop);
|
G_LOCK (main_loop);
|
||||||
|
|
||||||
source->hook.flags &= ~G_HOOK_FLAG_IN_CALL;
|
source->hook.flags &= ~G_HOOK_FLAG_IN_CALL;
|
||||||
|
|
||||||
if (need_destroy)
|
if (need_destroy)
|
||||||
g_hook_destroy_link (&source_list, (GHook *)source);
|
g_hook_destroy_link (&source_list, (GHook *) source);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_hook_unref (&source_list, (GHook *)source);
|
g_hook_unref (&source_list, (GHook *)source);
|
||||||
@@ -381,7 +396,8 @@ g_main_dispatch (GTimeVal *current_time)
|
|||||||
* run the loop.
|
* run the loop.
|
||||||
*/
|
*/
|
||||||
static gboolean
|
static gboolean
|
||||||
g_main_iterate (gboolean block, gboolean dispatch)
|
g_main_iterate (gboolean block,
|
||||||
|
gboolean dispatch)
|
||||||
{
|
{
|
||||||
GHook *hook;
|
GHook *hook;
|
||||||
GTimeVal current_time;
|
GTimeVal current_time;
|
||||||
|
Reference in New Issue
Block a user