diff --git a/doc/sys_arch.txt b/doc/sys_arch.txt index b517de26..44fa3372 100644 --- a/doc/sys_arch.txt +++ b/doc/sys_arch.txt @@ -120,10 +120,10 @@ 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) +- sys_thread_t sys_thread_new(void (* thread)(void *arg), void *arg, int prio) - Starts a new thread that will begin its execution in the function - "thread()". The "arg" argument will be passed as an argument to the + 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. - sys_prot_t sys_arch_protect(void) diff --git a/src/api/tcpip.c b/src/api/tcpip.c index 77dc2145..cfeeb9e7 100644 --- a/src/api/tcpip.c +++ b/src/api/tcpip.c @@ -165,7 +165,7 @@ tcpip_init(void (* initfunc)(void *), void *arg) tcpip_init_done = initfunc; tcpip_init_done_arg = arg; mbox = sys_mbox_new(); - sys_thread_new(tcpip_thread, NULL); + sys_thread_new(tcpip_thread, NULL, TCPIP_THREAD_PRIO); } /*-----------------------------------------------------------------------------------*/ diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h index 347d1a46..9f0660bd 100644 --- a/src/include/lwip/opt.h +++ b/src/include/lwip/opt.h @@ -296,6 +296,18 @@ a lot of data that needs to be copied, this should be set high. */ #define LWIP_COMPAT_SOCKETS 1 #endif + +#ifndef TCPIP_THREAD_PRIO +#define TCPIP_THREAD_PRIO 1 +#endif + +#ifndef SLIPIF_THREAD_PRIO +#define SLIPIF_THREAD_PRIO 1 +#endif + +#ifndef DEFAULT_THREAD_PRIO +#define DEFAULT_THREAD_PRIO 1 +#endif /* ---------- Statistics options ---------- */ #ifndef LWIP_STATS #define LWIP_STATS 1 diff --git a/src/include/lwip/sys.h b/src/include/lwip/sys.h index 8c05cf42..94bc0790 100644 --- a/src/include/lwip/sys.h +++ b/src/include/lwip/sys.h @@ -57,7 +57,7 @@ struct sys_timeout {u8_t dummy;}; #define sys_mbox_post(m,d) #define sys_mbox_free(m) -#define sys_thread_new(t,a) +#define sys_thread_new(t,a,p) /* We don't need protection if there is no OS */ #define SYS_ARCH_DECL_PROTECT(lev) @@ -157,7 +157,7 @@ void sys_arch_unprotect(sys_prot_t pval); #endif /* SYS_ARCH_PROTECT */ /* Thread functions. */ -sys_thread_t sys_thread_new(void (* thread)(void *arg), void *arg); +sys_thread_t sys_thread_new(void (* thread)(void *arg), void *arg, int prio); /* The following functions are used only in Unix code, and can be omitted when porting the stack. */ diff --git a/src/netif/slipif.c b/src/netif/slipif.c index 2375db44..ef43a04d 100644 --- a/src/netif/slipif.c +++ b/src/netif/slipif.c @@ -212,6 +212,6 @@ slipif_init(struct netif *netif) if (!netif->state) return ERR_IF; - sys_thread_new(slipif_loop, netif); + sys_thread_new(slipif_loop, netif, SLIPIF_THREAD_PRIO); return ERR_OK; }