qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kgiu...@apache.org
Subject svn commit: r1672125 - in /qpid/dispatch/trunk: include/qpid/dispatch/timer.h src/server.c src/timer.c src/timer_private.h
Date Wed, 08 Apr 2015 17:24:31 GMT
Author: kgiusti
Date: Wed Apr  8 17:24:31 2015
New Revision: 1672125

URL: http://svn.apache.org/r1672125
Log:
DISPATCH-132: use 64 bit time values

Modified:
    qpid/dispatch/trunk/include/qpid/dispatch/timer.h
    qpid/dispatch/trunk/src/server.c
    qpid/dispatch/trunk/src/timer.c
    qpid/dispatch/trunk/src/timer_private.h

Modified: qpid/dispatch/trunk/include/qpid/dispatch/timer.h
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/include/qpid/dispatch/timer.h?rev=1672125&r1=1672124&r2=1672125&view=diff
==============================================================================
--- qpid/dispatch/trunk/include/qpid/dispatch/timer.h (original)
+++ qpid/dispatch/trunk/include/qpid/dispatch/timer.h Wed Apr  8 17:24:31 2015
@@ -21,6 +21,7 @@
 
 #include <qpid/dispatch/dispatch.h>
 #include <qpid/dispatch/server.h>
+#include <stdint.h>
 
 /**@file
  * Server Timer Functions
@@ -32,6 +33,7 @@
  */
 
 typedef struct qd_timer_t qd_timer_t;
+typedef int64_t qd_timestamp_t;
 
 /**
  * Timer Callback
@@ -75,7 +77,7 @@ void qd_timer_free(qd_timer_t *timer);
  * @param msec The minimum number of milliseconds of delay until the timer fires.
  *             If 0 is supplied, the timer will be scheduled to fire immediately.
  */
-void qd_timer_schedule(qd_timer_t *timer, long msec);
+void qd_timer_schedule(qd_timer_t *timer, qd_timestamp_t msec);
 
 
 /**

Modified: qpid/dispatch/trunk/src/server.c
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/src/server.c?rev=1672125&r1=1672124&r2=1672125&view=diff
==============================================================================
--- qpid/dispatch/trunk/src/server.c (original)
+++ qpid/dispatch/trunk/src/server.c Wed Apr  8 17:24:31 2015
@@ -514,7 +514,7 @@ static void *thread_run(void *arg)
                 // use this value in driver_wait as the timeout.  If there are no scheduled
                 // timers, the returned value will be -1.
                 //
-                long duration = qd_timer_next_duration_LH();
+                qd_timestamp_t duration = qd_timer_next_duration_LH();
 
                 //
                 // Invoke the proton driver's wait sequence.  This is a bit of a hack for
now
@@ -548,7 +548,7 @@ static void *thread_run(void *arg)
                 //
                 struct timespec tv;
                 clock_gettime(CLOCK_REALTIME, &tv);
-                long milliseconds = tv.tv_sec * 1000 + tv.tv_nsec / 1000000;
+                qd_timestamp_t milliseconds = ((qd_timestamp_t)tv.tv_sec) * 1000 + tv.tv_nsec
/ 1000000;
                 qd_timer_visit_LH(milliseconds);
 
                 //

Modified: qpid/dispatch/trunk/src/timer.c
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/src/timer.c?rev=1672125&r1=1672124&r2=1672125&view=diff
==============================================================================
--- qpid/dispatch/trunk/src/timer.c (original)
+++ qpid/dispatch/trunk/src/timer.c Wed Apr  8 17:24:31 2015
@@ -29,7 +29,7 @@
 static sys_mutex_t     *lock;
 static qd_timer_list_t  idle_timers;
 static qd_timer_list_t  scheduled_timers;
-static long             time_base;
+static qd_timestamp_t   time_base;
 
 ALLOC_DECLARE(qd_timer_t);
 ALLOC_DEFINE(qd_timer_t);
@@ -107,11 +107,11 @@ void qd_timer_free(qd_timer_t *timer)
 }
 
 
-void qd_timer_schedule(qd_timer_t *timer, long duration)
+void qd_timer_schedule(qd_timer_t *timer, qd_timestamp_t duration)
 {
-    qd_timer_t *ptr;
-    qd_timer_t *last;
-    long        total_time;
+    qd_timer_t     *ptr;
+    qd_timer_t     *last;
+    qd_timestamp_t  total_time;
 
     sys_mutex_lock(lock);
     qd_timer_cancel_LH(timer);  // Timer is now on the idle list
@@ -196,7 +196,7 @@ void qd_timer_finalize(void)
 }
 
 
-long qd_timer_next_duration_LH(void)
+qd_timestamp_t qd_timer_next_duration_LH(void)
 {
     qd_timer_t *timer = DEQ_HEAD(scheduled_timers);
     if (timer)
@@ -205,10 +205,10 @@ long qd_timer_next_duration_LH(void)
 }
 
 
-void qd_timer_visit_LH(long current_time)
+void qd_timer_visit_LH(qd_timestamp_t current_time)
 {
-    long        delta;
-    qd_timer_t *timer = DEQ_HEAD(scheduled_timers);
+    qd_timestamp_t  delta;
+    qd_timer_t     *timer = DEQ_HEAD(scheduled_timers);
 
     if (time_base == 0) {
         time_base = current_time;

Modified: qpid/dispatch/trunk/src/timer_private.h
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/src/timer_private.h?rev=1672125&r1=1672124&r2=1672125&view=diff
==============================================================================
--- qpid/dispatch/trunk/src/timer_private.h (original)
+++ qpid/dispatch/trunk/src/timer_private.h Wed Apr  8 17:24:31 2015
@@ -36,7 +36,7 @@ struct qd_timer_t {
     qd_server_t      *server;
     qd_timer_cb_t     handler;
     void             *context;
-    long              delta_time;
+    qd_timestamp_t    delta_time;
     qd_timer_state_t  state;
 };
 
@@ -44,8 +44,8 @@ DEQ_DECLARE(qd_timer_t, qd_timer_list_t)
 
 void qd_timer_initialize(sys_mutex_t *server_lock);
 void qd_timer_finalize(void);
-long qd_timer_next_duration_LH(void);
-void qd_timer_visit_LH(long current_time);
+qd_timestamp_t qd_timer_next_duration_LH(void);
+void qd_timer_visit_LH(qd_timestamp_t current_time);
 void qd_timer_idle_LH(qd_timer_t *timer);
 
 /// For tests only



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message