lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] Re: [lwip] The timers in the TCP


From: Adam Dunkels
Subject: [lwip-users] Re: [lwip] The timers in the TCP
Date: Wed, 08 Jan 2003 22:42:45 -0000

Hi!

On Saturday 02 February 2002 16:26, you wrote:
> Hi , I have a question regarding the timers in the tcp module - the delay
> ack and the rtx. This is the scenario:
> while handling a certion tcp_pcb in the main thread in tcp_output, the
> tcp_timer_coarse is called and use the unacked and unsent lists of the
> current handled pcb in the main thread. Is this scenario safe - it seems to
> me that both threads can use the unacked and unsent lists of the same pcb?

You are right - the TCP timers should not be invoked while other TCP/IP code 
is executed. This can be assured be either encapsulating the TCP/IP code and 
TCP timers in semaphores that blocks whenever one or the other is executing, 
but the simplest approach is the one described in a recent mail:

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]