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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 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 [email protected] http://lists.nongnu.org/mailman/listinfo/lwip-users _______________________________________________ lwip-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/lwip-users
