# HG changeset patch # User asl # Date 1052737385 0 # Node ID 047e31b98f1072e3a9d1982444e53d095f5cf20d # Parent 9dd1e2b5492e1b9888c82776e5c04fd143d31156 * 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. diff --git a/packages/net/bsd_tcpip/current/ChangeLog b/packages/net/bsd_tcpip/current/ChangeLog --- a/packages/net/bsd_tcpip/current/ChangeLog +++ b/packages/net/bsd_tcpip/current/ChangeLog @@ -1,3 +1,13 @@ +2003-05-12 Motoya Kurotsu + + * 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 * src/ecos/support.c (_show_ifp): Display the IPv6 flag diff --git a/packages/net/bsd_tcpip/current/src/ecos/timeout.c b/packages/net/bsd_tcpip/current/src/ecos/timeout.c --- 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;