[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] lwip_select() blocks even if timeout is 0
From: |
Jonathan Larmour |
Subject: |
Re: [lwip-users] lwip_select() blocks even if timeout is 0 |
Date: |
Mon, 06 Oct 2008 19:18:34 +0100 |
User-agent: |
Thunderbird 1.5.0.12 (X11/20070530) |
Chu, Zhenwei wrote:
> Yes, it is lwIP 1.3.0. timeout is set to 0, and timeout->tv_sec = 0
> and timeout->tv_usec=0. The section of code from sockets.c is copied
> here.
I was wondering how you called lwip_select, not the code that's called.
> lwip_select()
> {
> ....
>
> /* add our semaphore to list */
> /* We don't actually need any dynamic memory. Our entry on the
> * list is only valid while we are in this function, so it's ok
> * to use local variables */
>
> select_cb.sem = sys_sem_new(0);
[snip]
But the code that deals with not blocking is in the bit you have cut out
with "....".
As Rishi said, the bit that starts:
/* If we don't have any current events, then suspend if we are supposed to */
if (!nready) {
if (timeout && timeout->tv_sec == 0 && timeout->tv_usec == 0) {
is the bit which means that lwip_select does not block if the timeout
duration is 0.
Jifl
--
eCosCentric Limited http://www.eCosCentric.com/ The eCos experts
Barnwell House, Barnwell Drive, Cambridge, UK. Tel: +44 1223 245571
Registered in England and Wales: Reg No 4422071.
------["Si fractum non sit, noli id reficere"]------ Opinions==mine