Skip to content

Commit

Permalink
port: add config ZEPHYR_WORK_ON_USERSPACE
Browse files Browse the repository at this point in the history
bug: v/42708

1. let ZEPHYR_WORK_ON_USERSPACE decide k_thread_create implementation.
2. use pthread_create replace nxthread_create when work at usersapce.

Signed-off-by: fangzhenwei <[email protected]>
  • Loading branch information
Frozen935 authored and pengxianghao21 committed Jan 13, 2025
1 parent 447057b commit 69aecba
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
4 changes: 4 additions & 0 deletions port/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ if BT
source "$APPSDIR/external/zblue/zblue/port/Kconfig.zephyr"
endif

config ZEPHYR_WORK_ON_USERSPACE
bool "zephyr bluetooth work on userspace"
default y

config ZEPHYR_WORK_QUEUE
bool "Use zephyr system work queue"
default y
Expand Down
13 changes: 6 additions & 7 deletions port/kernel/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ int k_is_preempt_thread(void)
return (sched == SCHED_RR);
}

#ifdef CONFIG_SCHED_WAITPID
#if defined(CONFIG_SCHED_WAITPID) && !defined(CONFIG_ZEPHYR_WORK_ON_USERSPACE)
static int k_thread_main(int argc, FAR char *argv[])
{
struct sched_param param;
Expand Down Expand Up @@ -193,12 +193,6 @@ k_tid_t k_thread_create(struct k_thread *new_thread,
return (k_tid_t)ret;
}

void k_thread_abort(k_tid_t thread)
{
//nxthread_delete((int)thread->init_data);
return ;
}

#else /* !CONFIG_SCHED_WAITPID */
static void *k_thread_main(void * args)
{
Expand Down Expand Up @@ -280,6 +274,11 @@ void k_thread_start(k_tid_t thread)
(void)thread;
}

void k_thread_abort(k_tid_t thread)
{
(void)thread;
}

bool k_is_in_isr(void)
{
return false;
Expand Down

0 comments on commit 69aecba

Please sign in to comment.