s/current_time/dispatch_time/ for the dispatch() handlers. refetch the
authorTim Janik <timj@gtk.org>
Wed, 26 Jan 2000 04:29:06 +0000 (04:29 +0000)
committerTim Janik <timj@src.gnome.org>
Wed, 26 Jan 2000 04:29:06 +0000 (04:29 +0000)
Wed Jan 26 05:24:38 2000  Tim Janik  <timj@gtk.org>

        * glib.h:
        * gmain.c: s/current_time/dispatch_time/ for the dispatch() handlers.
        refetch the current time after invocation of poll() to cover up for
        the time spent in that function call.

12 files changed:
ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
glib.h
glib/glib.h
glib/gmain.c
gmain.c

index 8731bf1..dcb42bb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Wed Jan 26 05:24:38 2000  Tim Janik  <timj@gtk.org>
+
+       * glib.h:
+       * gmain.c: s/current_time/dispatch_time/ for the dispatch() handlers.
+       refetch the current time after invocation of poll() to cover up for
+       the time spent in that function call.
+
 Fri Jan 21 10:18:24 2000  Owen Taylor  <otaylor@redhat.com>
 
        * glib.h (G_N_ELEMENTS): Added G_N_ELEMENTS macro to determine
index 8731bf1..dcb42bb 100644 (file)
@@ -1,3 +1,10 @@
+Wed Jan 26 05:24:38 2000  Tim Janik  <timj@gtk.org>
+
+       * glib.h:
+       * gmain.c: s/current_time/dispatch_time/ for the dispatch() handlers.
+       refetch the current time after invocation of poll() to cover up for
+       the time spent in that function call.
+
 Fri Jan 21 10:18:24 2000  Owen Taylor  <otaylor@redhat.com>
 
        * glib.h (G_N_ELEMENTS): Added G_N_ELEMENTS macro to determine
index 8731bf1..dcb42bb 100644 (file)
@@ -1,3 +1,10 @@
+Wed Jan 26 05:24:38 2000  Tim Janik  <timj@gtk.org>
+
+       * glib.h:
+       * gmain.c: s/current_time/dispatch_time/ for the dispatch() handlers.
+       refetch the current time after invocation of poll() to cover up for
+       the time spent in that function call.
+
 Fri Jan 21 10:18:24 2000  Owen Taylor  <otaylor@redhat.com>
 
        * glib.h (G_N_ELEMENTS): Added G_N_ELEMENTS macro to determine
index 8731bf1..dcb42bb 100644 (file)
@@ -1,3 +1,10 @@
+Wed Jan 26 05:24:38 2000  Tim Janik  <timj@gtk.org>
+
+       * glib.h:
+       * gmain.c: s/current_time/dispatch_time/ for the dispatch() handlers.
+       refetch the current time after invocation of poll() to cover up for
+       the time spent in that function call.
+
 Fri Jan 21 10:18:24 2000  Owen Taylor  <otaylor@redhat.com>
 
        * glib.h (G_N_ELEMENTS): Added G_N_ELEMENTS macro to determine
index 8731bf1..dcb42bb 100644 (file)
@@ -1,3 +1,10 @@
+Wed Jan 26 05:24:38 2000  Tim Janik  <timj@gtk.org>
+
+       * glib.h:
+       * gmain.c: s/current_time/dispatch_time/ for the dispatch() handlers.
+       refetch the current time after invocation of poll() to cover up for
+       the time spent in that function call.
+
 Fri Jan 21 10:18:24 2000  Owen Taylor  <otaylor@redhat.com>
 
        * glib.h (G_N_ELEMENTS): Added G_N_ELEMENTS macro to determine
index 8731bf1..dcb42bb 100644 (file)
@@ -1,3 +1,10 @@
+Wed Jan 26 05:24:38 2000  Tim Janik  <timj@gtk.org>
+
+       * glib.h:
+       * gmain.c: s/current_time/dispatch_time/ for the dispatch() handlers.
+       refetch the current time after invocation of poll() to cover up for
+       the time spent in that function call.
+
 Fri Jan 21 10:18:24 2000  Owen Taylor  <otaylor@redhat.com>
 
        * glib.h (G_N_ELEMENTS): Added G_N_ELEMENTS macro to determine
index 8731bf1..dcb42bb 100644 (file)
@@ -1,3 +1,10 @@
+Wed Jan 26 05:24:38 2000  Tim Janik  <timj@gtk.org>
+
+       * glib.h:
+       * gmain.c: s/current_time/dispatch_time/ for the dispatch() handlers.
+       refetch the current time after invocation of poll() to cover up for
+       the time spent in that function call.
+
 Fri Jan 21 10:18:24 2000  Owen Taylor  <otaylor@redhat.com>
 
        * glib.h (G_N_ELEMENTS): Added G_N_ELEMENTS macro to determine
index 8731bf1..dcb42bb 100644 (file)
@@ -1,3 +1,10 @@
+Wed Jan 26 05:24:38 2000  Tim Janik  <timj@gtk.org>
+
+       * glib.h:
+       * gmain.c: s/current_time/dispatch_time/ for the dispatch() handlers.
+       refetch the current time after invocation of poll() to cover up for
+       the time spent in that function call.
+
 Fri Jan 21 10:18:24 2000  Owen Taylor  <otaylor@redhat.com>
 
        * glib.h (G_N_ELEMENTS): Added G_N_ELEMENTS macro to determine
diff --git a/glib.h b/glib.h
index 92397dd..0379126 100644 (file)
--- a/glib.h
+++ b/glib.h
@@ -138,7 +138,7 @@ extern "C" {
  * as such; using this with a dynamically allocated array will give
  * incorrect results.
  */
-#define G_N_ELEMENTS(arr)              (sizeof(arr) / sizeof((arr)[0]))
+#define G_N_ELEMENTS(arr)              (sizeof (arr) / sizeof ((arr)[0]))
 
 /* Define G_VA_COPY() to do the right thing for copying va_list variables.
  * glibconfig.h may have already defined G_VA_COPY as va_copy or __va_copy.
@@ -2649,7 +2649,7 @@ struct _GSourceFuncs
                        GTimeVal *current_time,
                        gpointer  user_data);
   gboolean (*dispatch) (gpointer  source_data, 
-                       GTimeVal *current_time,
+                       GTimeVal *dispatch_time,
                        gpointer  user_data);
   GDestroyNotify destroy;
 };
@@ -2677,7 +2677,7 @@ gboolean g_source_remove_by_source_data      (gpointer       source_data);
 gboolean g_source_remove_by_funcs_user_data  (GSourceFuncs  *funcs,
                                              gpointer       user_data);
 
-void g_get_current_time                    (GTimeVal      *result);
+void g_get_current_time                        (GTimeVal       *result);
 
 /* Running the main loop */
 GMainLoop*     g_main_new              (gboolean        is_running);
index 92397dd..0379126 100644 (file)
@@ -138,7 +138,7 @@ extern "C" {
  * as such; using this with a dynamically allocated array will give
  * incorrect results.
  */
-#define G_N_ELEMENTS(arr)              (sizeof(arr) / sizeof((arr)[0]))
+#define G_N_ELEMENTS(arr)              (sizeof (arr) / sizeof ((arr)[0]))
 
 /* Define G_VA_COPY() to do the right thing for copying va_list variables.
  * glibconfig.h may have already defined G_VA_COPY as va_copy or __va_copy.
@@ -2649,7 +2649,7 @@ struct _GSourceFuncs
                        GTimeVal *current_time,
                        gpointer  user_data);
   gboolean (*dispatch) (gpointer  source_data, 
-                       GTimeVal *current_time,
+                       GTimeVal *dispatch_time,
                        gpointer  user_data);
   GDestroyNotify destroy;
 };
@@ -2677,7 +2677,7 @@ gboolean g_source_remove_by_source_data      (gpointer       source_data);
 gboolean g_source_remove_by_funcs_user_data  (GSourceFuncs  *funcs,
                                              gpointer       user_data);
 
-void g_get_current_time                    (GTimeVal      *result);
+void g_get_current_time                        (GTimeVal       *result);
 
 /* Running the main loop */
 GMainLoop*     g_main_new              (gboolean        is_running);
index 7a08bc1..a16021b 100644 (file)
@@ -122,7 +122,7 @@ static gboolean g_timeout_check        (gpointer  source_data,
                                        GTimeVal *current_time,
                                        gpointer  user_data);
 static gboolean g_timeout_dispatch     (gpointer  source_data,
-                                       GTimeVal *current_time,
+                                       GTimeVal *dispatch_time,
                                        gpointer  user_data);
 static gboolean g_idle_prepare         (gpointer  source_data, 
                                        GTimeVal *current_time,
@@ -132,7 +132,7 @@ static gboolean g_idle_check           (gpointer  source_data,
                                        GTimeVal *current_time,
                                        gpointer  user_data);
 static gboolean g_idle_dispatch        (gpointer  source_data,
-                                       GTimeVal *current_time,
+                                       GTimeVal *dispatch_time,
                                        gpointer  user_data);
 
 /* Data */
@@ -629,7 +629,7 @@ g_get_current_time (GTimeVal *result)
 
 /* HOLDS: main_loop_lock */
 static void
-g_main_dispatch (GTimeVal *current_time)
+g_main_dispatch (GTimeVal *dispatch_time)
 {
   while (pending_dispatches != NULL)
     {
@@ -657,7 +657,7 @@ g_main_dispatch (GTimeVal *current_time)
 
          G_UNLOCK (main_loop);
          need_destroy = ! dispatch (source_data,
-                                    current_time,
+                                    dispatch_time,
                                     hook_data);
          G_LOCK (main_loop);
 
@@ -707,7 +707,7 @@ g_main_iterate (gboolean block,
                gboolean dispatch)
 {
   GHook *hook;
-  GTimeVal current_time  ={ 0, 0 };
+  GTimeVal current_time  = { 0, 0 };
   gint n_ready = 0;
   gint current_priority = 0;
   gint timeout;
@@ -810,6 +810,9 @@ g_main_iterate (gboolean block,
 
   g_main_poll (timeout, n_ready > 0, current_priority);
 
+  if (timeout != 0)
+    g_get_current_time (&current_time);
+  
   /* Check to see what sources need to be dispatched */
 
   n_ready = 0;
@@ -1264,7 +1267,7 @@ g_timeout_check (gpointer  source_data,
 
 static gboolean
 g_timeout_dispatch (gpointer source_data, 
-                   GTimeVal *current_time,
+                   GTimeVal *dispatch_time,
                    gpointer user_data)
 {
   GTimeoutData *data = source_data;
@@ -1274,8 +1277,8 @@ g_timeout_dispatch (gpointer source_data,
       guint seconds = data->interval / 1000;
       guint msecs = data->interval - seconds * 1000;
 
-      data->expiration.tv_sec = current_time->tv_sec + seconds;
-      data->expiration.tv_usec = current_time->tv_usec + msecs * 1000;
+      data->expiration.tv_sec = dispatch_time->tv_sec + seconds;
+      data->expiration.tv_usec = dispatch_time->tv_usec + msecs * 1000;
       if (data->expiration.tv_usec >= 1000000)
        {
          data->expiration.tv_usec -= 1000000;
@@ -1347,7 +1350,7 @@ g_idle_check    (gpointer  source_data,
 
 static gboolean
 g_idle_dispatch (gpointer source_data, 
-                GTimeVal *current_time,
+                GTimeVal *dispatch_time,
                 gpointer user_data)
 {
   GSourceFunc func = source_data;
diff --git a/gmain.c b/gmain.c
index 7a08bc1..a16021b 100644 (file)
--- a/gmain.c
+++ b/gmain.c
@@ -122,7 +122,7 @@ static gboolean g_timeout_check        (gpointer  source_data,
                                        GTimeVal *current_time,
                                        gpointer  user_data);
 static gboolean g_timeout_dispatch     (gpointer  source_data,
-                                       GTimeVal *current_time,
+                                       GTimeVal *dispatch_time,
                                        gpointer  user_data);
 static gboolean g_idle_prepare         (gpointer  source_data, 
                                        GTimeVal *current_time,
@@ -132,7 +132,7 @@ static gboolean g_idle_check           (gpointer  source_data,
                                        GTimeVal *current_time,
                                        gpointer  user_data);
 static gboolean g_idle_dispatch        (gpointer  source_data,
-                                       GTimeVal *current_time,
+                                       GTimeVal *dispatch_time,
                                        gpointer  user_data);
 
 /* Data */
@@ -629,7 +629,7 @@ g_get_current_time (GTimeVal *result)
 
 /* HOLDS: main_loop_lock */
 static void
-g_main_dispatch (GTimeVal *current_time)
+g_main_dispatch (GTimeVal *dispatch_time)
 {
   while (pending_dispatches != NULL)
     {
@@ -657,7 +657,7 @@ g_main_dispatch (GTimeVal *current_time)
 
          G_UNLOCK (main_loop);
          need_destroy = ! dispatch (source_data,
-                                    current_time,
+                                    dispatch_time,
                                     hook_data);
          G_LOCK (main_loop);
 
@@ -707,7 +707,7 @@ g_main_iterate (gboolean block,
                gboolean dispatch)
 {
   GHook *hook;
-  GTimeVal current_time  ={ 0, 0 };
+  GTimeVal current_time  = { 0, 0 };
   gint n_ready = 0;
   gint current_priority = 0;
   gint timeout;
@@ -810,6 +810,9 @@ g_main_iterate (gboolean block,
 
   g_main_poll (timeout, n_ready > 0, current_priority);
 
+  if (timeout != 0)
+    g_get_current_time (&current_time);
+  
   /* Check to see what sources need to be dispatched */
 
   n_ready = 0;
@@ -1264,7 +1267,7 @@ g_timeout_check (gpointer  source_data,
 
 static gboolean
 g_timeout_dispatch (gpointer source_data, 
-                   GTimeVal *current_time,
+                   GTimeVal *dispatch_time,
                    gpointer user_data)
 {
   GTimeoutData *data = source_data;
@@ -1274,8 +1277,8 @@ g_timeout_dispatch (gpointer source_data,
       guint seconds = data->interval / 1000;
       guint msecs = data->interval - seconds * 1000;
 
-      data->expiration.tv_sec = current_time->tv_sec + seconds;
-      data->expiration.tv_usec = current_time->tv_usec + msecs * 1000;
+      data->expiration.tv_sec = dispatch_time->tv_sec + seconds;
+      data->expiration.tv_usec = dispatch_time->tv_usec + msecs * 1000;
       if (data->expiration.tv_usec >= 1000000)
        {
          data->expiration.tv_usec -= 1000000;
@@ -1347,7 +1350,7 @@ g_idle_check    (gpointer  source_data,
 
 static gboolean
 g_idle_dispatch (gpointer source_data, 
-                GTimeVal *current_time,
+                GTimeVal *dispatch_time,
                 gpointer user_data)
 {
   GSourceFunc func = source_data;