lwip-users
[Top][All Lists]
Advanced

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

RE: [lwip-users] Compile errors with lwip 0.7.0 and contrib-20040122


From: John Taylor
Subject: RE: [lwip-users] Compile errors with lwip 0.7.0 and contrib-20040122
Date: Wed, 28 Jan 2004 14:57:05 -0500

>>No, the sys_msleep() call is required for the lwip timers to fire
>>properly.
>>
>sys_msleep() is not required for the lwIP timers at all. Just do a
>find/grep on the code and you'll see that it is nowhere called except 
>from PPP. I have lwIP running nicely with sys_msleep() compeletely 
>removed.

You are correct, that the lwIP timer mechanism is not dependent on the
sys_msleep() call/implementation. The lwIP timer mechanism works by
'taking over' the waiting whenever the application calls
sys_mbox_fetch(), sys_sema_wait_timeout(), and sys_sema_wait(). Instead
of just blocking until signaled, these call actually
block-with-a-timeout where the timeout period is the period of the next
registered timer to expire (Note: sys_wait_timeout() is implemented by
first registering a timer for the user specified timeout period and then
waiting to be signal). If lwIP registers a timer, via sys_timeout(), and
then never calls sys_sema_wait(), sys_sema_wait_timeout(), or
sys_mbox_fetch() such that these calls block, none of the registered
timers ever expire.

Now back to sys_msleep().  Currently sys_msleep() is implemented by
calling sys_sema_wait_timeout().  This is done so that while the thread
is sleeping/waiting, any registered timers will *still* expire
correctly.  Bypassing the sys_sema_wait_timeout() implementation will
have a *negative* effect on all currently registered timers of the
thread that calls sys_msleep(). 

As I said before having a native implementation of sys_msleep() is 'OK'
under certain circumstances.  As you pointed out, sys_msleep() is
*currently* only used in the PPP code.  And I am guessing that its usage
is such that there are no registered timer(s) when it is called.  

The problem with using a alternate implementation for sys_msleep()
arises with future releases of lwIP.  New releases, new applications,
etc. may use sys_msleep() more extensive than it is currently being
used.  In which case, you will see the negative impact on timers.  Now
the likely hood of this happening is another topic in its own right. 

-john






reply via email to

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