lwip-users
[Top][All Lists]
Advanced

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

AW: [lwip-users] WG: select timeout


From: Mathias Zenger
Subject: AW: [lwip-users] WG: select timeout
Date: Tue, 2 Feb 2010 14:08:23 +0100

Kieran: Thanks for the hints.

I tried to debug the timeout problem but it's quite tricky for me. I agree
that it's probably a problem in the port (ATMEL Software Framework 1.4.0,
lwIP stack 1.3.0). Obviousely a timeout == NULL or a timeout > 0 give the
same behaviour (blocking infinite).

I can see the timeout correctly being transferd to sys_sem_wait_timeout() in
sys.c (in my case 5000 which is a 5 seconds timeout). I can execute the call
to sys_timeout() but in the next line sys_sem_wait(sem) does never return.

...
if (timeout > 0) {
   /* Create a timer and pass it the address of our flag */
   sys_timeout(timeout, sswt_handler, &sswt_cb);
}
sys_sem_wait(sem);
...

As far as I see sys_sem_wait() does a call to sys_arch_sem_wait(). The
passed semaphore is the same:

...
timeouts = sys_arch_timeouts();

if (!timeouts || !timeouts->next) {
   sys_arch_sem_wait(sem, 0);
} else {
    if (timeouts->next->time > 0) {
      time = sys_arch_sem_wait(sem, timeouts->next->time);
    } else {
      time = SYS_ARCH_TIMEOUT;
    }
...

Here I have the problem that it calls sys_arch_sem_wait(sem, 0) due to the
fact that timeouts->next == 0. This leads me to the assumption that the
timer was not correctly handled/registered in sys_timeout(timeout,
sswt_handler, &sswt_cb). Otherwise the timouts list from sys_arch_timeouts()
should contain my timeout??

Looking at sys_arch_sem_wait() I see a comment which explains the behaviour:
// If timeout=0, then the function should block indefinitely.
That's exactly not what I want!

I am a bit lost and would appreciate your help. Where shall I dig? :)



-----Ursprüngliche Nachricht-----
Von: Kieran Mansley [mailto:address@hidden
Gesendet: Montag, 1. Februar 2010 13:45
An: address@hidden; Mailing list for lwIP users
Betreff: Re: [lwip-users] WG: select timeout


On Mon, 2010-02-01 at 13:32 +0100, Mathias Zenger wrote:
> Hi,
>
> I still have this problem with the select() function. Does anybody have
> experience with the select() timeout in lwIP? If it runs fine for you
> probably the port on my platform is faulty. Thanks for your assistance.

It's very likely to be your port - I don't recall any recent bugs due to
select timeout problems (but it might be wise to do a quick search of
the lwip-devel mailing list just to be sure).

You could try upgrading to 1.3.2 in case there was a problem in the
stack, or the port you're using, that got fixed in the upgrade.

The timeout is implemented (in current lwIP at least) using
sys_sem_wait_timeout(), which in turn uses sys_arch_sem_wait() which
will be part of your port.  You should be able to look at how this
operates to check its behaviour.

Kieran






reply via email to

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