* sys.h, api_lib.c: Provide new sys_mbox_tryfetch function.

Require ports to provide new sys_arch_mbox_tryfetch function to get
    a message if one is there, otherwise return with SYS_MBOX_EMPTY.
This commit is contained in:
jifl
2007-04-11 15:41:03 +00:00
parent 05909d6fa7
commit 0c94f22ded
3 changed files with 16 additions and 2 deletions

View File

@@ -284,7 +284,7 @@ netconn_delete(struct netconn *conn)
/* Drain the recvmbox. */
if (conn->recvmbox != SYS_MBOX_NULL) {
while (sys_arch_mbox_fetch(conn->recvmbox, &mem, 1) != SYS_ARCH_TIMEOUT) {
while (sys_mbox_tryfetch(conn->recvmbox, &mem) != SYS_MBOX_EMPTY) {
if (conn->type == NETCONN_TCP) {
if(mem != NULL)
pbuf_free((struct pbuf *)mem);
@@ -299,7 +299,7 @@ netconn_delete(struct netconn *conn)
/* Drain the acceptmbox. */
if (conn->acceptmbox != SYS_MBOX_NULL) {
while (sys_arch_mbox_fetch(conn->acceptmbox, &mem, 1) != SYS_ARCH_TIMEOUT) {
while (sys_mbox_tryfetch(conn->acceptmbox, &mem) != SYS_MBOX_EMPTY) {
netconn_delete((struct netconn *)mem);
}
sys_mbox_free(conn->acceptmbox);