lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] Re: [lwip] tcp_slowtmr


From: Adam Dunkels
Subject: [lwip-users] Re: [lwip] tcp_slowtmr
Date: Thu, 09 Jan 2003 01:50:28 -0000

Hi Rajeev!

On Friday 01 February 2002 08.48, you wrote:
>   i call the tcp_slowtmr every 500 ms in the timer ISR. i have implemented
> semaphores to prevent nesting of interrupts. i'm not able to comprehend the
> strange logging of the debug messages in the debug.log file. the characters
> are being overwritten and some characs are missing. can anybody throw some
> light on this.

It does look a lot like the timer interrupts and the stack threads are 
interleaved. The tcp_slowtmr() and tcp_fasttmr() function must not be called 
while the stack code is executing (processing an incoming packet for 
instance). Since the operate on the same datastructures, really bad things 
are likely to happen.

Also, since tcp_slowtmr() can take quite some time to complete, it is better 
not to have it run as an interrupt handler. A better design would be 
something like this:

main() {
  init_everything();
  while(1) {
    wait_until_timer_fires_or_packet_is_received();
    if(packet_is_received) {
      ip_input();
    } 
    if(timer_fired) {
      do_timer_stuff_such_as_tcp_slowtmr_or_tcp_fasttmr();
    }
  }
}

/adam
-- 
Adam Dunkels <address@hidden>
http://www.sics.se/~adam
[This message was sent through the lwip discussion list.]




reply via email to

[Prev in Thread] Current Thread [Next in Thread]