lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] sys_arch.c timeout of zero problem


From: David Shmelzer
Subject: [lwip-users] sys_arch.c timeout of zero problem
Date: Tue, 11 Aug 2009 12:51:59 -0400

My application requires that netconn_recv() be non-blocking and to
return immediately of there is no message waiting.
So I modified sys_arch.c to convert small timeout values to zero for the
queue wait. 
But I run into problems if the xQueueReceive timeout is 0. The TCP
connection closes after ~5 netconn_recv calls. Everything works fine if
the xQueueReceive blocks for at least 1 tick.
Does the lwIP architecture REQUIRE that netconn_recv allow the lwIP
thread to run? 
Is there a reason that it was designed such that a timeout of 0 means
wait forever instead of peek? 


Here's my modification to sys_arch.c:

u32_t sys_arch_mbox_fetch(sys_mbox_t mbox, void **msg, u32_t timeout)
{
...
        if ( timeout != 0 )
        {
            timeout >>= 2; <<<<<---- added this line which converts
timeout in ms to ticks
                if ( pdTRUE == xQueueReceive( mbox, &(*msg), timeout ) )
...



Thanks
-Dave




reply via email to

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