lwip-users
[Top][All Lists]
Advanced

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

RE: [lwip-users] lwip_select() blocks even if timeout is 0


From: Chu, Zhenwei
Subject: RE: [lwip-users] lwip_select() blocks even if timeout is 0
Date: Mon, 6 Oct 2008 14:44:34 -0400

The application calls select(), not lwip_select(). The original code is
ported from Linux version.

I think my problem is to set timeout as 0. Make timeout->tv_sec = 0 and
timeout->tv_usec=0, but not timeout, solve the problem.

Thanks for help.

Zhenwei 




-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf
Of Jonathan Larmour
Sent: Monday, October 06, 2008 2:19 PM
To: Mailing list for lwIP users
Subject: Re: [lwip-users] lwip_select() blocks even if timeout is 0

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


_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users




reply via email to

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