]> xenbits.xensource.com Git - unikraft/libs/lwip.git/commitdiff
Adhering to uksched API for thread creation
authorSharan Santhanam <sharan.santhanam@neclab.eu>
Wed, 13 Jun 2018 13:41:46 +0000 (15:41 +0200)
committerSimon Kuenzer <simon.kuenzer@neclab.eu>
Thu, 14 Jun 2018 23:26:45 +0000 (01:26 +0200)
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 <sharan.santhanam@neclab.eu>
threads.c

index 79d06faf911a7476ae53ed273d87f26212dc8943..1e6be4d79002a4fa5904d346d3c69a0677551d7a 100644 (file)
--- 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;
 }