diff --git a/samples/userspace/prod_consumer/src/main.c b/samples/userspace/prod_consumer/src/main.c index 156533e8177..6253077845c 100644 --- a/samples/userspace/prod_consumer/src/main.c +++ b/samples/userspace/prod_consumer/src/main.c @@ -17,6 +17,7 @@ #include "app_b.h" #define APP_A_STACKSIZE 2048 +#define APP_B_STACKSIZE 2048 LOG_MODULE_REGISTER(app_main); @@ -45,8 +46,13 @@ K_QUEUE_DEFINE(shared_queue_outgoing); struct k_thread app_a_thread; K_THREAD_STACK_DEFINE(app_a_stack, APP_A_STACKSIZE); +struct k_thread app_b_thread; +K_THREAD_STACK_DEFINE(app_b_stack, APP_B_STACKSIZE); + void main(void) { + k_tid_t thread_a, thread_b; + LOG_INF("APP A partition: %p %zu", (void *)app_a_partition.start, (size_t)app_a_partition.size); LOG_INF("Shared partition: %p %zu", (void *)shared_partition.start, @@ -58,10 +64,15 @@ void main(void) sys_heap_init(&shared_pool, shared_pool_mem, HEAP_BYTES); /* Spawn supervisor entry for application A */ - k_thread_create(&app_a_thread, app_a_stack, APP_A_STACKSIZE, - app_a_entry, NULL, NULL, NULL, - -1, K_INHERIT_PERMS, K_NO_WAIT); + thread_a = k_thread_create(&app_a_thread, app_a_stack, APP_A_STACKSIZE, + app_a_entry, NULL, NULL, NULL, + -1, K_INHERIT_PERMS, K_NO_WAIT); - /* Re-use main for app B supervisor mode setup */ - app_b_entry(NULL, NULL, NULL); + /* Spawn supervisor entry for application B */ + thread_b = k_thread_create(&app_b_thread, app_b_stack, APP_A_STACKSIZE, + app_b_entry, NULL, NULL, NULL, + -1, K_INHERIT_PERMS, K_NO_WAIT); + + k_thread_join(thread_a, K_FOREVER); + k_thread_join(thread_b, K_FOREVER); }