sys.h, sys.c, api_lib.c, tcpip.c: remove sys_mbox_fetch_timeout() (was only used for LWIP_SO_RCVTIMEO option) and use sys_arch_mbox_fetch() instead of sys_mbox_fetch() in api files. Now, users SHOULD NOT use internal lwIP features like "sys_timeout" in their application threads.

This commit is contained in:
fbernon
2007-05-22 20:51:34 +00:00
parent 0aaf69769f
commit 2ff620e1b5
5 changed files with 18 additions and 62 deletions

View File

@@ -44,11 +44,8 @@ struct sswt_cb
};
#if LWIP_SO_RCVTIMEO
void sys_mbox_fetch_timeout(sys_mbox_t mbox, void **msg, u32_t timeout)
#else
void sys_mbox_fetch(sys_mbox_t mbox, void **msg)
#endif /* LWIP_SO_RCVTIMEO */
void
sys_mbox_fetch(sys_mbox_t mbox, void **msg)
{
u32_t time;
struct sys_timeouts *timeouts;
@@ -60,38 +57,15 @@ void sys_mbox_fetch(sys_mbox_t mbox, void **msg)
timeouts = sys_arch_timeouts();
if (!timeouts || !timeouts->next) {
#if LWIP_SO_RCVTIMEO
time = sys_arch_mbox_fetch(mbox, msg, timeout);
#else
time = sys_arch_mbox_fetch(mbox, msg, 0);
#endif /* LWIP_SO_RCVTIMEO */
} else {
if (timeouts->next->time > 0) {
#if LWIP_SO_RCVTIMEO
time = sys_arch_mbox_fetch(mbox, msg, (timeout?((timeout<timeouts->next->time)?timeout:timeouts->next->time):timeouts->next->time));
#else
time = sys_arch_mbox_fetch(mbox, msg, timeouts->next->time);
#endif /* LWIP_SO_RCVTIMEO */
} else {
time = SYS_ARCH_TIMEOUT;
}
if (time == SYS_ARCH_TIMEOUT) {
#if LWIP_SO_RCVTIMEO
if ((timeout) && (timeout<timeouts->next->time)) {
/* If time == SYS_ARCH_TIMEOUT, and we have wait "fetch's timeout" and not "timer's timeout",
The timeout variable is the number of milliseconds we have waited for the message. */
timeouts->next->time -= timeout;
} else {
/* The timeouts->next->time variable is the number of milliseconds we have waited for the message. */
if (timeouts->next->time < timeout) {
timeout -= timeouts->next->time;
} else {
/* either timeout == 0, or timeout must == timeouts->next->time */
if (timeout) timeout = SYS_ARCH_TIMEOUT;
}
#endif /* LWIP_SO_RCVTIMEO */
/* If time == SYS_ARCH_TIMEOUT, a timeout occured before a message
could be fetched. We should now call the timeout handler and
deallocate the memory allocated for the timeout. */
@@ -104,16 +78,9 @@ void sys_mbox_fetch(sys_mbox_t mbox, void **msg)
LWIP_DEBUGF(SYS_DEBUG, ("smf calling h=%p(%p)\n", (void *)h, (void *)arg));
h(arg);
}
#if LWIP_SO_RCVTIMEO
if (timeout != SYS_ARCH_TIMEOUT)
#endif /* LWIP_SO_RCVTIMEO */
/* We try again to fetch a message from the mbox. */
goto again;
#if LWIP_SO_RCVTIMEO
}
#endif /* LWIP_SO_RCVTIMEO */
} else {
/* If time != SYS_ARCH_TIMEOUT, a message was received before the timeout
occured. The time variable is set to the number of
@@ -124,14 +91,7 @@ void sys_mbox_fetch(sys_mbox_t mbox, void **msg)
timeouts->next->time = 0;
}
}
}
#if LWIP_SO_RCVTIMEO
if ((time == SYS_ARCH_TIMEOUT) && (msg))
{ (*msg)=NULL;
}
#endif /* LWIP_SO_RCVTIMEO */
}
void