changeset 1011:047e31b98f10

* src/ecos/timeout.c (do_timeout): The head of the linked list of timers is timeout, not _timeout. * src/ecos/timeout.c (timeout): Linear search the array for empty entries and don't walk it like a linked list, because it is not. * src/ecos/timeout.c (untimeout): Linear search is faster since there are many entries in the linked list which are not in the array.
author asl
date Mon, 12 May 2003 11:03:05 +0000
parents 9dd1e2b5492e
children a1a864a858b5
files packages/net/bsd_tcpip/current/ChangeLog packages/net/bsd_tcpip/current/src/ecos/timeout.c
diffstat 2 files changed, 15 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/packages/net/bsd_tcpip/current/ChangeLog
+++ b/packages/net/bsd_tcpip/current/ChangeLog
@@ -1,3 +1,13 @@
+2003-05-12  Motoya Kurotsu  <kurotsu@allied-telesis.co.jp>
+
+	* src/ecos/timeout.c (do_timeout): The head of the linked list of
+	timers is timeout, not _timeout.
+	* src/ecos/timeout.c (timeout): Linear search the array for empty 
+	entries and don't walk it like a linked list, because it is not.
+	* src/ecos/timeout.c (untimeout): Linear search is faster since 
+	there are many entries in the linked list which are not in the 
+	array.
+
 2003-05-12  Andrew Lunn  <andrew.lunn@ascom.ch>
 
 	* src/ecos/support.c (_show_ifp): Display the IPv6 flag
--- a/packages/net/bsd_tcpip/current/src/ecos/timeout.c
+++ b/packages/net/bsd_tcpip/current/src/ecos/timeout.c
@@ -101,7 +101,7 @@ do_timeout(void)
     min_delta = last_delta; // local copy
     last_delta = -1; // flag recursive call underway
 
-    e = _timeouts;
+    e = timeouts;
     while (e) {
         e_next = e->next;  // Because this can change during processing
         if (e->delta) {
@@ -262,6 +262,7 @@ cyg_alarm_timeout_init( void )
 cyg_uint32
 timeout(timeout_fun *fun, void *arg, cyg_int32 delta)
 {
+    int i;
     timeout_entry *e;
     cyg_uint32 stamp;
 
@@ -270,7 +271,7 @@ timeout(timeout_fun *fun, void *arg, cyg
     int spl = cyg_splinternal();
 
     stamp = 0;  // Assume no slots available
-    for (e = _timeouts;  e;  e = e->next) {
+    for (e = _timeouts, i = 0;  i < NTIMEOUTS;  i++, e++) {
         if ((e->flags & CALLOUT_PENDING) == 0) {
             // Free entry
             callout_init(e);
@@ -291,10 +292,11 @@ timeout(timeout_fun *fun, void *arg, cyg
 void
 untimeout(timeout_fun *fun, void * arg)
 {
+    int i;
     timeout_entry *e;
     int spl = cyg_splinternal();
 
-    for (e = _timeouts;  e; e = e->next) {
+    for (e = _timeouts, i = 0; i < NTIMEOUTS; i++, e++) {
         if (e->delta && (e->fun == fun) && (e->arg == arg)) {
             callout_stop(e);
             break;