blob: 21ca839efc40c5927bd72e5d5606716c7a55823f [file] [log] [blame]
/*
* Copyright (c) 2023 Intel Corporation.
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* This code demonstrates the use of threads and requires object
* relocation support.
*/
#include <stdint.h>
#include <zephyr/llext/symbol.h>
#include <zephyr/kernel.h>
#include "threads_kernel_objects_ext.h"
void test_thread(void *arg0, void *arg1, void *arg2)
{
printk("Take semaphore from test thread\n");
k_sem_take(&my_sem, K_FOREVER);
}
void test_entry(void)
{
printk("Give semaphore from main thread\n");
k_sem_give(&my_sem);
printk("Creating thread\n");
k_tid_t tid = k_thread_create(&my_thread, (k_thread_stack_t *) &my_thread_stack,
MY_THREAD_STACK_SIZE, &test_thread, NULL, NULL, NULL,
MY_THREAD_PRIO, MY_THREAD_OPTIONS, K_FOREVER);
printk("Starting thread\n");
k_thread_start(tid);
printk("Joining thread\n");
k_thread_join(&my_thread, K_FOREVER);
printk("Test thread joined\n");
}
LL_EXTENSION_SYMBOL(test_entry);