|
From: | address@hidden |
Subject: | Re: [lwip-users] Timers Question |
Date: | Fri, 10 Apr 2009 07:50:28 +0200 |
User-agent: | Thunderbird 2.0.0.21 (Macintosh/20090302) |
@Younger: There is no function like 'main_thread' in the lwip source! What you have to do isa) provide a timeouts structure per thread, sys_arch_timeouts() must return a unique structure for the currently running thread b) provide the correct wait-time return values for sys_arch_sem_wait() and sys_arch_mbox_fetch()
sys_sem_wait() and sys_mbox_fetch() will call the timeout handlers when enough time has passed waiting for semaphores/mboxes. The protocol timers are initialized in tcpip_init(), from v1.3.0 on you just have to call lwip_init().
The downside of this timer-approach is that timers are not really accurate when processor load is high in the tcpip_thread (active time vs. wait time) or if you never really wait much at all on sems/mboxes. There is a task on savannah for this to be implemented better (also for NO_SYS=1 which currently can't use the timeouts) but for now, this is how you have to do it.
Simon John Kennedy wrote:
Hi, I'm porting lwip using an RTOS and sockets, but I'm not certain what I have to do about timers. Using an RTOS do I need to periodically call any timer functions within lwip like etharp_tmr, tcp_tmr, dns_tmr, dhcp_coarse_tmr, dhcp_fine_tmr, ip_reass_tmr, igmp_tmr, autoip_tmr? Thanks, John
[Prev in Thread] | Current Thread | [Next in Thread] |