sys_thread_t sys_thread_new(const char *name, lwip_thread_fn thread, void *arg,
int stacksize, int prio __unused)
{
+ struct uk_sched *s = uk_sched_current();
struct uk_thread *t;
- if (stacksize > (__ssz) __STACK_SIZE) {
- UK_CRASH("Can't create lwIP thread: stack size %u is too large (> %llu). Dying...\n",
- stacksize, __STACK_SIZE);
+ UK_ASSERT(s);
+
+ t = uk_sched_thread_create_fn1(s,
+ (uk_thread_fn1_t) thread, arg,
+ (size_t) stacksize,
+ false,
+ false,
+ name,
+ NULL, NULL);
+ if (!t) {
+ uk_pr_err("Failed to create lwIP thread '%s'\n", name);
+ return NULL;
}
- t = uk_thread_create(name, thread, arg);
return t;
}
#else /* CONFIG_LWIP_NOTHREADS */
-static void _poll_netif(void *arg)
+static __noreturn void _poll_netif(void *arg)
{
struct netif *nf = (struct netif *) arg;
("%s: Poll receive enabled\n",
__func__));
/* Create a thread */
- lwip_data->sched = uk_sched_get_default();
+ lwip_data->sched = uk_sched_current();
UK_ASSERT(lwip_data->sched);
lwip_data->poll_thread =
- uk_sched_thread_create(lwip_data->sched, NULL,
- NULL, _poll_netif, nf);
+ uk_sched_thread_create(lwip_data->sched,
+ _poll_netif, nf, NULL);
#else /* CONFIG_HAVE_SCHED */
uk_pr_warn("The netdevice does not support interrupt. Ensure the netdevice is polled to receive packets");
#endif /* CONFIG_HAVE_SCHED */
rxq_conf.callback = uknetdev_input;
rxq_conf.callback_cookie = nf;
#ifdef CONFIG_LIBUKNETDEV_DISPATCHERTHREADS
- rxq_conf.s = uk_sched_get_default();
+ rxq_conf.s = uk_sched_current();
if (!rxq_conf.s)
return ERR_IF;