Removed conn->sem creation and destruction from netconn_write() and added sys_sem_new to netconn_new_*

This commit is contained in:
christiaans 2006-05-26 07:39:39 +00:00
parent 6158aa684b
commit 7026bbcdd4
2 changed files with 13 additions and 12 deletions

View File

@ -15,12 +15,20 @@ FUTURE
a thread subsystem. Either PPP needs to be moved to contrib/ports/??? a thread subsystem. Either PPP needs to be moved to contrib/ports/???
or rearranged to be more generic. or rearranged to be more generic.
* TODO: review the the sequential netconn and socket API (lwip/src/api)
for bugs and performance issues. Frequent system calls (e.g. sys_mbox_fetch)
slooow things down considerably.
HISTORY HISTORY
(CVS HEAD) (CVS HEAD)
* [Enter new changes just after this line - do not remove this line] * [Enter new changes just after this line - do not remove this line]
2006-05-26 Christiaan Simons
* api_lib.c: Removed conn->sem creation and destruction
from netconn_write() and added sys_sem_new to netconn_new_*.
2006-03-29 Christiaan Simons 2006-03-29 Christiaan Simons
* inet.c, inet.h: Added platform byteswap support. * inet.c, inet.h: Added platform byteswap support.
Added LWIP_PLATFORM_BYTESWAP define (defaults to 0) and Added LWIP_PLATFORM_BYTESWAP define (defaults to 0) and

View File

@ -215,7 +215,11 @@ netconn *netconn_new_with_proto_and_callback(enum netconn_type t, u16_t proto,
} }
conn->recvmbox = SYS_MBOX_NULL; conn->recvmbox = SYS_MBOX_NULL;
conn->acceptmbox = SYS_MBOX_NULL; conn->acceptmbox = SYS_MBOX_NULL;
conn->sem = SYS_SEM_NULL; conn->sem = sys_sem_new(0);
if (conn->sem == SYS_SEM_NULL) {
memp_free(MEMP_NETCONN, conn);
return NULL;
}
conn->state = NETCONN_NONE; conn->state = NETCONN_NONE;
conn->socket = 0; conn->socket = 0;
conn->callback = callback; conn->callback = callback;
@ -631,13 +635,6 @@ netconn_write(struct netconn *conn, void *dataptr, u16_t size, u8_t copy)
return conn->err; return conn->err;
} }
if (conn->sem == SYS_SEM_NULL) {
conn->sem = sys_sem_new(0);
if (conn->sem == SYS_SEM_NULL) {
return ERR_MEM;
}
}
if ((msg = memp_malloc(MEMP_API_MSG)) == NULL) { if ((msg = memp_malloc(MEMP_API_MSG)) == NULL) {
return (conn->err = ERR_MEM); return (conn->err = ERR_MEM);
} }
@ -685,10 +682,6 @@ netconn_write(struct netconn *conn, void *dataptr, u16_t size, u8_t copy)
ret: ret:
memp_free(MEMP_API_MSG, msg); memp_free(MEMP_API_MSG, msg);
conn->state = NETCONN_NONE; conn->state = NETCONN_NONE;
if (conn->sem != SYS_SEM_NULL) {
sys_sem_free(conn->sem);
conn->sem = SYS_SEM_NULL;
}
return conn->err; return conn->err;
} }