Change parameters list for sys_thread_new (see "task #7252 : Create sys_thread_new_ex()"). Two new parameters have to be provided: a task name, and a task stack size. For this one, since it's platform dependant, you could define the best one for you in your lwipopts.h. For port maintainers, you can just add these new parameters in your sys_arch.c file, and but it's not mandatory, use them in your OS specific functions.

This commit is contained in:
fbernon 2007-09-05 16:14:28 +00:00
parent c1f89c5640
commit 90a3f88c08
7 changed files with 89 additions and 15 deletions

View File

@ -19,6 +19,15 @@ HISTORY
++ New features:
2007-09-05 Frédéric Bernon, Bill Florac
* opt.h, sys.h, tcpip.c, slipif.c, ppp.c, sys_arch.txt: Change parameters list
for sys_thread_new (see "task #7252 : Create sys_thread_new_ex()"). Two new
parameters have to be provided: a task name, and a task stack size. For this
one, since it's platform dependant, you could define the best one for you in
your lwipopts.h. For port maintainers, you can just add these new parameters
in your sys_arch.c file, and but it's not mandatory, use them in your OS
specific functions.
2007-09-05 Frédéric Bernon
* inet.c, autoip.c, msg_in.c, msg_out.c, init.c: Move some build time checkings
inside init.c for task #7142 "Sanity check user-configurable values".

View File

@ -128,12 +128,13 @@ If threads are supported by the underlying operating system and if
such functionality is needed in lwIP, the following function will have
to be implemented as well:
- sys_thread_t sys_thread_new(void (* thread)(void *arg), void *arg, int prio)
- sys_thread_t sys_thread_new(char *name, void (* thread)(void *arg), void *arg, int stacksize, int prio)
Starts a new thread with priority "prio" that will begin its execution in the
function "thread()". The "arg" argument will be passed as an argument to the
thread() function. The id of the new thread is returned. Both the id and
the priority are system dependent.
Starts a new thread named "name" with priority "prio" that will begin its
execution in the function "thread()". The "arg" argument will be passed as an
argument to the thread() function. The stack size to used for this thread is
the "stacksize" parameter. The id of the new thread is returned. Both the id
and the priority are system dependent.
- sys_prot_t sys_arch_protect(void)

View File

@ -543,7 +543,7 @@ tcpip_init(void (* initfunc)(void *), void *arg)
lock_tcpip_core = sys_sem_new(1);
#endif /* LWIP_TCPIP_CORE_LOCKING */
sys_thread_new(tcpip_thread, NULL, TCPIP_THREAD_PRIO);
sys_thread_new(TCPIP_THREAD_NAME, tcpip_thread, NULL, TCPIP_THREAD_STACKSIZE, TCPIP_THREAD_PRIO);
}
#endif /* !NO_SYS */

View File

@ -741,37 +741,101 @@
---------- Thread options ----------
------------------------------------
*/
/**
* TCPIP_THREAD_NAME: The name assigned to the main tcpip thread.
*/
#ifndef TCPIP_THREAD_NAME
#define TCPIP_THREAD_NAME "tcpip_thread"
#endif
/**
* TCPIP_THREAD_STACKSIZE: The stack size used by the main tcpip thread.
* The stack size value itself is platform-dependent, but is passed to
* sys_thread_new() when the thread is created.
*/
#ifndef TCPIP_THREAD_STACKSIZE
#define TCPIP_THREAD_STACKSIZE 0
#endif
/**
* TCPIP_THREAD_PRIO: The priority assigned to the main tcpip thread.
* The priority value itself is platform-dependent, but is passed to
* sys_thread_new() when tcpip_thread is created.
* sys_thread_new() when the thread is created.
*/
#ifndef TCPIP_THREAD_PRIO
#define TCPIP_THREAD_PRIO 1
#endif
/**
* SLIPIF_THREAD_NAME: The name assigned to the slipif_loop thread.
*/
#ifndef SLIPIF_THREAD_NAME
#define SLIPIF_THREAD_NAME "slipif_loop"
#endif
/**
* SLIP_THREAD_STACKSIZE: The stack size used by the slipif_loop thread.
* The stack size value itself is platform-dependent, but is passed to
* sys_thread_new() when the thread is created.
*/
#ifndef SLIPIF_THREAD_STACKSIZE
#define SLIPIF_THREAD_STACKSIZE 0
#endif
/**
* SLIPIF_THREAD_PRIO: The priority assigned to the slipif_loop thread.
* The priority value itself is platform-dependent, but is passed to
* sys_thread_new() when slipif_loop is created.
* sys_thread_new() when the thread is created.
*/
#ifndef SLIPIF_THREAD_PRIO
#define SLIPIF_THREAD_PRIO 1
#endif
/**
* PPP_THREAD_NAME: The name assigned to the pppMain thread.
*/
#ifndef PPP_THREAD_NAME
#define PPP_THREAD_NAME "pppMain"
#endif
/**
* PPP_THREAD_STACKSIZE: The stack size used by the pppMain thread.
* The stack size value itself is platform-dependent, but is passed to
* sys_thread_new() when the thread is created.
*/
#ifndef PPP_THREAD_STACKSIZE
#define PPP_THREAD_STACKSIZE 0
#endif
/**
* PPP_THREAD_PRIO: The priority assigned to the pppMain thread.
* The priority value itself is platform-dependent, but is passed to
* sys_thread_new() when pppMain is created.
* sys_thread_new() when the thread is created.
*/
#ifndef PPP_THREAD_PRIO
#define PPP_THREAD_PRIO 1
#endif
/**
* DEFAULT_THREAD_PRIO: The priority assigned to the pppMain thread.
* DEFAULT_THREAD_NAME: The name assigned to any other lwIP thread.
*/
#ifndef DEFAULT_THREAD_NAME
#define DEFAULT_THREAD_NAME "lwIP"
#endif
/**
* DEFAULT_THREAD_STACKSIZE: The stack size used by any other lwIP thread.
* The stack size value itself is platform-dependent, but is passed to
* sys_thread_new() when the thread is created.
*/
#ifndef DEFAULT_THREAD_STACKSIZE
#define DEFAULT_THREAD_STACKSIZE 0
#endif
/**
* DEFAULT_THREAD_PRIO: The priority assigned to any other lwIP thread.
* The priority value itself is platform-dependent, but is passed to
* sys_thread_new() when pppMain is created.
* sys_thread_new() when the thread is created.
*/
#ifndef DEFAULT_THREAD_PRIO
#define DEFAULT_THREAD_PRIO 1

View File

@ -62,7 +62,7 @@ struct sys_timeo {u8_t dummy;};
#define sys_mbox_post(m,d)
#define sys_mbox_free(m)
#define sys_thread_new(t,a,p)
#define sys_thread_new(n,t,a,s,p)
#else /* NO_SYS */
@ -134,7 +134,7 @@ void sys_mbox_free(sys_mbox_t mbox);
void sys_mbox_fetch(sys_mbox_t mbox, void **msg);
/* Thread functions. */
sys_thread_t sys_thread_new(void (* thread)(void *arg), void *arg, int prio);
sys_thread_t sys_thread_new(char *name, void (* thread)(void *arg), void *arg, int stacksize, int prio);
/* The following functions are used only in Unix code, and
can be omitted when porting the stack. */

View File

@ -532,7 +532,7 @@ int pppOverSerialOpen(sio_fd_t fd, void (*linkStatusCB)(void *ctx, int errCode,
pc->linkStatusCB = linkStatusCB;
pc->linkStatusCtx = linkStatusCtx;
sys_thread_new(pppMain, (void*)pd, PPP_THREAD_PRIO);
sys_thread_new(PPP_THREAD_NAME, pppMain, (void*)pd, PPP_THREAD_STACKSIZE, PPP_THREAD_PRIO);
if(!linkStatusCB) {
while(pd >= 0 && !pc->if_up) {
sys_msleep(500);

View File

@ -267,6 +267,6 @@ slipif_init(struct netif *netif)
NETIF_INIT_SNMP(netif, snmp_ifType_slip, 0);
/* Create a thread to poll the serial line. */
sys_thread_new(slipif_loop, netif, SLIPIF_THREAD_PRIO);
sys_thread_new(SLIPIF_THREAD_NAME, slipif_loop, netif, SLIPIF_THREAD_STACKSIZE, SLIPIF_THREAD_PRIO);
return ERR_OK;
}