From: Sharan Santhanam Date: Wed, 13 Jun 2018 13:41:46 +0000 (+0200) Subject: Adhering to uksched API for thread creation X-Git-Tag: RELEASE-0.3~20 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=272550adb06ddac8cd338140dcb25c19dedf97af;p=unikraft%2Flibs%2Flwip.git Adhering to uksched API for thread creation sys_thread_new was unnecessarily using a static allocated variable for creating a thread. On failure, uk_printd() was called without specifying a level which fails. Additonally the code style of this function is updated. Signed-off-by: Sharan Santhanam --- diff --git a/threads.c b/threads.c index 79d06fa..1e6be4d 100644 --- a/threads.c +++ b/threads.c @@ -9,13 +9,15 @@ * 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. */ -sys_thread_t sys_thread_new(const char *name, lwip_thread_fn thread, void *arg, int stacksize, int prio) +sys_thread_t sys_thread_new(const char *name, lwip_thread_fn thread, void *arg, + int stacksize, int prio) { - static struct thread *t; - if (stacksize > __STACK_SIZE) { - uk_printd("Can't create lwIP thread: stack size %u is too large (> %u)\n", stacksize, __STACK_SIZE); - UK_CRASH("Dying\n"); - } - t = uk_thread_create((char *) name, NULL, thread, arg); - return t; + struct uk_thread *t; + if (stacksize > __STACK_SIZE) { + uk_printd(DLVL_CRIT, "Can't create lwIP thread: stack size %u is too large (> %u)\n", + stacksize, __STACK_SIZE); + UK_CRASH("Dying\n"); + } + t = uk_thread_create((char *) name, thread, arg); + return t; }