Home
last modified time | relevance | path

Searched full:thread (Results 1 – 25 of 1647) sorted by relevance

12345678910>>...66

/Zephyr-Core-3.7.0/samples/kernel/condition_variables/simple/
DREADME.rst11 to signal changing states (conditions) from worker thread to the main
12 thread. Main thread uses a condition variable to wait for a condition to
13 become true. Main thread and the worker thread alternate between their
14 execution based on when the worker thread signals the main thread that is
38 [thread 0] working (0/5)
39 [thread 1] working (0/5)
40 [thread 2] working (0/5)
41 [thread 3] working (0/5)
42 [thread 4] working (0/5)
43 [thread 5] working (0/5)
[all …]
/Zephyr-Core-3.7.0/kernel/include/
Dkthread.h28 * thread->next_thread (until NULL)
35 /* clean up when a thread is aborted */
38 void z_thread_monitor_exit(struct k_thread *thread);
40 #define z_thread_monitor_exit(thread) \ argument
46 static inline void thread_schedule_new(struct k_thread *thread, k_timeout_t delay) in thread_schedule_new() argument
50 k_thread_start(thread); in thread_schedule_new()
52 z_add_thread_timeout(thread, delay); in thread_schedule_new()
56 k_thread_start(thread); in thread_schedule_new()
60 static inline int thread_is_preemptible(struct k_thread *thread) in thread_is_preemptible() argument
63 return thread->base.preempt <= _PREEMPT_THRESHOLD; in thread_is_preemptible()
[all …]
Dpriority_q.h44 static ALWAYS_INLINE void z_priq_mq_add(struct _priq_mq *pq, struct k_thread *thread);
45 static ALWAYS_INLINE void z_priq_mq_remove(struct _priq_mq *pq, struct k_thread *thread);
60 static ALWAYS_INLINE void z_priq_dumb_remove(sys_dlist_t *pq, struct k_thread *thread) in z_priq_dumb_remove() argument
64 sys_dlist_remove(&thread->base.qnode_dlist); in z_priq_dumb_remove()
69 struct k_thread *thread = NULL; in z_priq_dumb_best() local
73 thread = CONTAINER_OF(n, struct k_thread, base.qnode_dlist); in z_priq_dumb_best()
75 return thread; in z_priq_dumb_best()
78 static ALWAYS_INLINE void z_priq_rb_add(struct _priq_rb *pq, struct k_thread *thread) in z_priq_rb_add() argument
82 thread->base.order_key = pq->next_order_key; in z_priq_rb_add()
98 rb_insert(&pq->tree, &thread->base.qnode_rb); in z_priq_rb_add()
[all …]
/Zephyr-Core-3.7.0/kernel/
Dsched.c33 /* Storage to "complete" the context switch from an invalid/incomplete thread
39 static void halt_thread(struct k_thread *thread, uint8_t new_state);
40 static void add_to_waitq_locked(struct k_thread *thread, _wait_q_t *wait_q);
50 * > 0 -> thread 1 priority > thread 2 priority
51 * = 0 -> thread 1 priority == thread 2 priority
52 * < 0 -> thread 1 priority < thread 2 priority
90 static ALWAYS_INLINE void *thread_runq(struct k_thread *thread) in thread_runq() argument
93 int cpu, m = thread->base.cpu_mask; in thread_runq()
96 * thread with all CPUs masked off (i.e. one that isn't in thread_runq()
105 ARG_UNUSED(thread); in thread_runq()
[all …]
Dthread_monitor.c13 * Remove a thread from the kernel's list of active threads.
15 void z_thread_monitor_exit(struct k_thread *thread) in z_thread_monitor_exit() argument
19 if (thread == _kernel.threads) { in z_thread_monitor_exit()
26 (thread != prev_thread->next_thread)) { in z_thread_monitor_exit()
30 prev_thread->next_thread = thread->next_thread; in z_thread_monitor_exit()
40 struct k_thread *thread; in k_thread_foreach() local
55 for (thread = _kernel.threads; thread; thread = thread->next_thread) { in k_thread_foreach()
56 user_cb(thread, user_data); in k_thread_foreach()
66 struct k_thread *thread; in k_thread_foreach_unlocked() local
75 for (thread = _kernel.threads; thread; thread = thread->next_thread) { in k_thread_foreach_unlocked()
[all …]
Dcpu_mask.c19 static int cpu_mask_mod(k_tid_t thread, uint32_t enable_mask, uint32_t disable_mask) in cpu_mask_mod() argument
24 __ASSERT(z_is_thread_prevented_from_running(thread), in cpu_mask_mod()
29 if (z_is_thread_prevented_from_running(thread)) { in cpu_mask_mod()
30 thread->base.cpu_mask |= enable_mask; in cpu_mask_mod()
31 thread->base.cpu_mask &= ~disable_mask; in cpu_mask_mod()
38 int m = thread->base.cpu_mask; in cpu_mask_mod()
47 int k_thread_cpu_mask_clear(k_tid_t thread) in k_thread_cpu_mask_clear() argument
49 return cpu_mask_mod(thread, 0, 0xffffffff); in k_thread_cpu_mask_clear()
52 int k_thread_cpu_mask_enable_all(k_tid_t thread) in k_thread_cpu_mask_enable_all() argument
54 return cpu_mask_mod(thread, 0xffffffff, 0); in k_thread_cpu_mask_enable_all()
[all …]
Dfloat.c11 int z_impl_k_float_disable(struct k_thread *thread) in z_impl_k_float_disable() argument
14 return arch_float_disable(thread); in z_impl_k_float_disable()
16 ARG_UNUSED(thread); in z_impl_k_float_disable()
21 int z_impl_k_float_enable(struct k_thread *thread, unsigned int options) in z_impl_k_float_enable() argument
24 return arch_float_enable(thread, options); in z_impl_k_float_enable()
26 ARG_UNUSED(thread); in z_impl_k_float_enable()
33 static inline int z_vrfy_k_float_disable(struct k_thread *thread) in z_vrfy_k_float_disable() argument
35 K_OOPS(K_SYSCALL_OBJ(thread, K_OBJ_THREAD)); in z_vrfy_k_float_disable()
36 return z_impl_k_float_disable(thread); in z_vrfy_k_float_disable()
40 static inline int z_vrfy_k_float_enable(struct k_thread *thread, unsigned int options) in z_vrfy_k_float_enable() argument
[all …]
/Zephyr-Core-3.7.0/doc/kernel/services/threads/
Dindex.rst16 A :dfn:`thread` is a kernel object that is used for application processing
20 available RAM). Each thread is referenced by a :dfn:`thread id` that is assigned
21 when the thread is spawned.
23 A thread has the following key properties:
25 * A **stack area**, which is a region of memory used for the thread's stack.
27 of the thread's processing. Special macros exist to create and work with
30 * A **thread control block** for private kernel bookkeeping of the thread's
33 * An **entry point function**, which is invoked when the thread is started.
37 allocate CPU time to the thread. (See :ref:`scheduling_v2`.)
39 * A set of **thread options**, which allow the thread to receive special
[all …]
Dsystem_threads.rst10 A :dfn:`system thread` is a thread that the kernel spawns automatically
15 **Main thread**
16 This thread performs kernel initialization, then calls the application's
19 By default, the main thread uses the highest configured preemptible thread
21 threads, the main thread uses the lowest configured cooperative thread
24 The main thread is an essential thread while it is performing kernel
26 this means a fatal system error is raised if the thread aborts. If
28 return, the main thread terminates normally and no error is raised.
30 **Idle thread**
31 This thread executes when there is no other work for the system to do.
[all …]
/Zephyr-Core-3.7.0/samples/kernel/condition_variables/condvar/
DREADME.rst12 to signal changing states (conditions) from one thread to another
13 thread. A thread uses a condition variable to wait for a condition to
15 function execution based on when they signal the other thread that is
39 Starting watch_count: thread 1
40 watch_count: thread 1 Count= 0. Going into wait...
41 inc_count: thread 2, count = 1, unlocking mutex
42 inc_count: thread 3, count = 2, unlocking mutex
43 inc_count: thread 2, count = 3, unlocking mutex
44 inc_count: thread 3, count = 4, unlocking mutex
45 inc_count: thread 2, count = 5, unlocking mutex
[all …]
/Zephyr-Core-3.7.0/subsys/tracing/user/
Dtracing_user.c12 void __weak sys_trace_thread_create_user(struct k_thread *thread) {} in sys_trace_thread_create_user() argument
13 void __weak sys_trace_thread_abort_user(struct k_thread *thread) {} in sys_trace_thread_abort_user() argument
14 void __weak sys_trace_thread_suspend_user(struct k_thread *thread) {} in sys_trace_thread_suspend_user() argument
15 void __weak sys_trace_thread_resume_user(struct k_thread *thread) {} in sys_trace_thread_resume_user() argument
16 void __weak sys_trace_thread_name_set_user(struct k_thread *thread) {} in sys_trace_thread_name_set_user() argument
19 void __weak sys_trace_thread_info_user(struct k_thread *thread) {} in sys_trace_thread_info_user() argument
20 void __weak sys_trace_thread_sched_ready_user(struct k_thread *thread) {} in sys_trace_thread_sched_ready_user() argument
21 void __weak sys_trace_thread_pend_user(struct k_thread *thread) {} in sys_trace_thread_pend_user() argument
22 void __weak sys_trace_thread_priority_set_user(struct k_thread *thread, int prio) {} in sys_trace_thread_priority_set_user() argument
29 void sys_trace_thread_create(struct k_thread *thread) in sys_trace_thread_create() argument
[all …]
/Zephyr-Core-3.7.0/arch/arc/core/
Dthread.c9 * @brief New thread creation for ARCv2
11 * Core thread related primitives for the ARCv2 processor architecture.
45 static bool is_user(struct k_thread *thread) in is_user() argument
47 return (thread->base.user_options & K_USER) != 0; in is_user()
51 /* Set all stack-related architecture variables for the provided thread */
52 static void setup_stack_vars(struct k_thread *thread) in setup_stack_vars() argument
55 if (is_user(thread)) { in setup_stack_vars()
57 thread->arch.priv_stack_start = in setup_stack_vars()
58 (uint32_t)z_priv_stack_find(thread->stack_obj); in setup_stack_vars()
60 thread->arch.priv_stack_start = (uint32_t)(thread->stack_obj); in setup_stack_vars()
[all …]
/Zephyr-Core-3.7.0/subsys/sensing/
DKconfig48 int "stack size for sensing subsystem runtime thread"
52 This is the stack size for sensing subsystem runtime thread
56 int "priority for sensing subsystem runtime thread"
60 This is the thread priority for sensor subsystem runtime thread
61 Ring buffer data is stored by runtime thread, and then give semaphore
62 to notify dispatch thread, runtime thread priority should lower than
63 dispatch thread priority to ensure dispatch thread could fetch data as
64 soon as runtime thread give semaphore. Take for example, if runtime
65 priority is higher than dispatch thread, and runtime running in full
66 loading with no sleep, then dispatch thread has no change to fetch
[all …]
/Zephyr-Core-3.7.0/subsys/tracing/sysview/
Dsysview_config.c20 static void set_thread_name(char *name, struct k_thread *thread) in set_thread_name() argument
22 const char *tname = k_thread_name_get(thread); in set_thread_name()
29 thread, &thread->entry); in set_thread_name()
33 void sys_trace_thread_info(struct k_thread *thread) in sys_trace_thread_info() argument
37 set_thread_name(name, thread); in sys_trace_thread_info()
41 Info.TaskID = (uint32_t)(uintptr_t)thread; in sys_trace_thread_info()
43 Info.Prio = thread->base.prio; in sys_trace_thread_info()
44 Info.StackBase = thread->stack_info.size; in sys_trace_thread_info()
45 Info.StackSize = thread->stack_info.start; in sys_trace_thread_info()
60 struct k_thread *thread; in send_task_list_cb() local
[all …]
/Zephyr-Core-3.7.0/doc/kernel/services/data_passing/
Dmailboxes.rst31 A thread that sends a message is known as the **sending thread**,
32 while a thread that receives the message is known as the **receiving thread**.
33 Each message may be received by only one thread (i.e. point-to-multipoint and
38 (and even specify) the identity of the other thread.
45 Both the sending thread and the receiving thread supply a message descriptor
55 A **message buffer** is an area of memory provided by the thread that sends or
69 it is given to a mailbox by the sending thread. The message is then owned
70 by the mailbox until it is given to a receiving thread. The receiving thread
75 Thread Compatibility
78 A sending thread can specify the address of the thread to which the message
[all …]
/Zephyr-Core-3.7.0/tests/kernel/context/
DREADME.txt12 - start a helper thread to help with k_yield() tests
13 - start a thread to test thread related functionality
16 - Called by a higher priority thread when there is another thread
17 - Called by an equal priority thread when there is another thread
18 - Called by a lower priority thread when there is another thread
22 - Called from an ISR (interrupted a thread)
24 - Called from a thread
28 - Called from an ISR that interrupted a thread
30 - Called from a thread
81 tc_start() - Test kernel CPU and thread routines
[all …]
/Zephyr-Core-3.7.0/arch/sparc/core/
Dthread.c10 void z_thread_entry_wrapper(k_thread_entry_t thread,
19 * required if we need to taken a trap (interrupt) in the thread entry wrapper.
31 void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack, in arch_new_thread() argument
40 thread->callee_saved.i0 = (uint32_t) entry; in arch_new_thread()
41 thread->callee_saved.i1 = (uint32_t) p1; in arch_new_thread()
42 thread->callee_saved.i2 = (uint32_t) p2; in arch_new_thread()
43 thread->callee_saved.i3 = (uint32_t) p3; in arch_new_thread()
44 thread->callee_saved.i6 = 0; /* frame pointer */ in arch_new_thread()
45 thread->callee_saved.o6 = (uint32_t) iframe; /* stack pointer */ in arch_new_thread()
46 thread->callee_saved.o7 = (uint32_t) z_thread_entry_wrapper - 8; in arch_new_thread()
[all …]
/Zephyr-Core-3.7.0/arch/x86/core/intel64/
Dthread.c13 extern void x86_sse_init(struct k_thread *thread); /* in locore.S */
28 void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack, in arch_new_thread() argument
44 switch_entry = z_x86_userspace_prepare_thread(thread); in arch_new_thread()
45 thread->arch.cs = X86_KERNEL_CS; in arch_new_thread()
46 thread->arch.ss = X86_KERNEL_DS; in arch_new_thread()
52 thread->callee_saved.rsp = (long) iframe; in arch_new_thread()
53 thread->callee_saved.rip = (long) switch_entry; in arch_new_thread()
54 thread->callee_saved.rflags = EFLAGS_INITIAL; in arch_new_thread()
57 * thread->callee_saved.rip in arch_new_thread()
59 thread->arch.rdi = (long) entry; in arch_new_thread()
[all …]
/Zephyr-Core-3.7.0/arch/arm/core/cortex_a_r/
Dthread.c10 * @brief New thread creation for ARM Cortex-A and Cortex-R
12 * Core thread related primitives for the ARM Cortex-A and
52 void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack, in arch_new_thread() argument
64 thread->stack_info.start += MPU_GUARD_ALIGN_AND_SIZE; in arch_new_thread()
65 thread->stack_info.size -= MPU_GUARD_ALIGN_AND_SIZE; in arch_new_thread()
69 if ((thread->base.user_options & K_FP_REGS) != 0) { in arch_new_thread()
75 thread->stack_info.start += FP_GUARD_EXTRA_SIZE; in arch_new_thread()
76 thread->stack_info.size -= FP_GUARD_EXTRA_SIZE; in arch_new_thread()
83 if ((thread->base.user_options & K_USER) != 0) { in arch_new_thread()
112 thread->callee_saved.psp = (uint32_t)iframe; in arch_new_thread()
[all …]
/Zephyr-Core-3.7.0/tests/kernel/threads/thread_apis/src/
Dtest_threads_cancel_abort.c25 /**TESTPOINT: abort current thread*/ in thread_entry_abort()
35 * @brief Validate k_thread_abort() when called by current thread
37 * @details Create a user thread and let the thread execute.
38 * Then call k_thread_abort() and check if the thread is terminated.
39 * Here the main thread is also a user thread.
49 /**TESTPOINT: spawned thread executed but abort itself*/ in ZTEST_USER()
55 * @brief Validate k_thread_abort() when called by other thread
57 * @details Create a user thread and abort the thread before its
58 * execution. Create a another user thread and abort the thread
72 /**TESTPOINT: check not-started thread is aborted*/ in ZTEST_USER()
[all …]
/Zephyr-Core-3.7.0/doc/kernel/services/scheduling/
Dindex.rst12 The scheduler determines which thread is allowed to execute
13 at any point in time; this thread is known as the **current thread**.
16 opportunity to change the identity of the current thread. These points
19 - transition of a thread from running state to a suspended or waiting
21 - transition of a thread to the :ref:`ready state <thread_states>`, for
23 - return to thread context after processing an interrupt
24 - when a running thread invokes :c:func:`k_yield`
26 A thread **sleeps** when it voluntarily initiates an operation that
29 Whenever the scheduler changes the identity of the current thread,
30 or when execution of the current thread is replaced by an ISR,
[all …]
/Zephyr-Core-3.7.0/arch/arm/core/cortex_m/
Dthread.c11 * @brief New thread creation for ARM Cortex-M
13 * Core thread related primitives for the ARM Cortex-M
61 void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack, in arch_new_thread() argument
73 thread->stack_info.start += MPU_GUARD_ALIGN_AND_SIZE; in arch_new_thread()
74 thread->stack_info.size -= MPU_GUARD_ALIGN_AND_SIZE; in arch_new_thread()
78 if ((thread->base.user_options & K_FP_REGS) != 0) { in arch_new_thread()
84 thread->stack_info.start += FP_GUARD_EXTRA_SIZE; in arch_new_thread()
85 thread->stack_info.size -= FP_GUARD_EXTRA_SIZE; in arch_new_thread()
92 if ((thread->base.user_options & K_USER) != 0) { in arch_new_thread()
111 thread->callee_saved.psp = (uint32_t)iframe; in arch_new_thread()
[all …]
/Zephyr-Core-3.7.0/drivers/sensor/adi/adt7310/
DKconfig25 Sets thread type for the interrupt handler.
31 bool "Use global thread"
34 Use a global thread for the interrupt handler.
37 bool "Use own thread"
40 Use a separate thread for the interrupt handler.
47 int "Thread priority of the interrupt handler"
50 Thread priority of the interrupt handler. A higher number implies a
51 higher priority. The thread is cooperative and will not be interrupted by
52 another thread until execution is released.
55 int "Stack size of the interrupt handler thread"
[all …]
/Zephyr-Core-3.7.0/tests/kernel/fifo/fifo_usage/src/
Dmain.c14 * Test Thread enters items into a fifo, starts the Child Thread
15 * and waits for a semaphore. Child thread extracts all items from
16 * the fifo and enters some items back into the fifo. Child Thread
17 * gives the semaphore for Test Thread to continue. Once the control
18 * is returned back to Test Thread, it extracts all items from the fifo.
21 * Test Thread enters an item into fifo2, starts a Child Thread and
22 * extract an item from fifo1 once the item is there. The Child Thread
24 * an item to fifo1. The flow of control goes from Test Thread to
25 * Child Thread and so forth.
28 * Tests the ISR interfaces. Test thread puts items into fifo2 and gives
[all …]
/Zephyr-Core-3.7.0/samples/userspace/syscall_perf/
DREADME.rst7 user thread has to go through a system call compared to a supervisor thread that
14 This application creates a supervisor and a user thread.
16 current thread. The user thread has to go through a system call.
27 User thread: 18012 cycles 748 instructions
28 Supervisor thread: 7 cycles 4 instructions
29 User thread: 20136 cycles 748 instructions
30 Supervisor thread: 7 cycles 4 instructions
31 User thread: 18014 cycles 748 instructions
32 Supervisor thread: 7 cycles 4 instructions

12345678910>>...66