[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [lwip-users] Explanation and purpose of timeouts
From: |
John Taylor |
Subject: |
RE: [lwip-users] Explanation and purpose of timeouts |
Date: |
Thu, 22 Jan 2004 13:21:39 -0500 |
>> I have been searching the archives for a good description of the
>> sys_timeouts structures, but didn't find anything that helped me
>> understand their purpose.
I had this same issue! I am new to lwip also, but here is what I have
figured out so far (you veterans feel free to correct me).
The short answer is: for porting to a new platform, you don't need to
know anything about it, just provide storage (and access) for the
sys_timeouts structure on a per-thread basis.
The long answer: lwip does not require/use a system-tick-source for
implementing timers and/or timeouts. Internally in the lwip code, when
it needs a timer, it calls sys_timeout() to register the timer.
sys_timeout() requires a timeout handler, which is a function callback
that is called when the timer expires. Instead of using a tick-source
to decrement the timers, lwip utilizes its 'wait' calls. Whenever lwip
makes a blocking-wait call (wait on semaphore, mailbox, or sleeping) it
is actually waiting on the 'next' registered sys_timeouts instance to
expire. This internal waiting may expired several times before the
top-level timeout period expires. All this magic is inside
lwip/src/core/sys.c.
I had not seen this approach/design for timers before, but I do see how
it simplifies the system_arch layer. What confused me for sometime is
that I automatically assumed that sys_sem_wait_timeout() mapped directly
to sys_arch_sem_wait() which it does *not*.
Hope this helps
-john
-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf
Of Chris Jones
Sent: Thursday, January 22, 2004 12:21 PM
To: address@hidden
Subject: [lwip-users] Explanation and purpose of timeouts
I have been searching the archives for a good description of the
sys_timeouts
structures, but didn't find anything that helped me understand their
purpose.
I have written a system architecture file that implements semaphores and
mailboxes
on the WIN32 API so that I can run lwIP in a multithreaded
configuration.
My goal is to port lwIP to a TI C55x DSP. I am using the WinXP build to
work
out
any issues with changing the definition of u8_t as 16 bits as it will be
on
the
DSP. I read several archived posts about issues with DSP porting and I
think
I have a
good handle on it.
I am also using the windows machine to integrate lwIP with the GoAhead
webserver.
I have started to debug the multithreaded lwIP on WIN32 and have run
into
problems with the sys_timeouts structures. It is unclear to me what is
being
timed out. Also I don't see how these timeout values get set in the
first
place.
I understand that I am going to have to create per thread timeout
structures
simlar
to the RTXC and unix ports, but I could use a better explanation of what
they
are used for.
Thanks,
Chris Jones
Engenium Technologies
www.engeniumtech.com
_______________________________________________
lwip-users mailing list
address@hidden
http://mail.gnu.org/mailman/listinfo/lwip-users