/Zephyr-latest/samples/kernel/condition_variables/simple/ |
D | README.rst | 13 to signal changing states (conditions) from worker thread to the main 14 thread. Main thread uses a condition variable to wait for a condition to 15 become true. Main thread and the worker thread alternate between their 16 execution based on when the worker thread signals the main thread that is 40 [thread 0] working (0/5) 41 [thread 1] working (0/5) 42 [thread 2] working (0/5) 43 [thread 3] working (0/5) 44 [thread 4] working (0/5) 45 [thread 5] working (0/5) [all …]
|
/Zephyr-latest/kernel/include/ |
D | kthread.h | 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() 67 static inline int thread_is_metairq(struct k_thread *thread) in thread_is_metairq() argument 70 return (thread->base.prio - K_HIGHEST_THREAD_PRIO) in thread_is_metairq() [all …]
|
D | ksched.h | 52 void z_move_thread_to_end_of_prio_q(struct k_thread *thread); 53 void z_unpend_thread_no_timeout(struct k_thread *thread); 57 void z_pend_thread(struct k_thread *thread, _wait_q_t *wait_q, 61 void z_unpend_thread(struct k_thread *thread); 63 bool z_thread_prio_set(struct k_thread *thread, int prio); 69 void z_sched_start(struct k_thread *thread); 70 void z_ready_thread(struct k_thread *thread); 73 void z_thread_abort(struct k_thread *thread); 74 void move_thread_to_end_of_prio_q(struct k_thread *thread); 75 bool thread_is_sliceable(struct k_thread *thread); [all …]
|
/Zephyr-latest/kernel/ |
D | sched.c | 39 static ALWAYS_INLINE 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); 48 static ALWAYS_INLINE void *thread_runq(struct k_thread *thread) in thread_runq() argument 51 int cpu, m = thread->base.cpu_mask; in thread_runq() 63 ARG_UNUSED(thread); in thread_runq() 77 static ALWAYS_INLINE void runq_add(struct k_thread *thread) in runq_add() argument 79 __ASSERT_NO_MSG(!z_is_idle_thread_object(thread)); in runq_add() 81 _priq_run_add(thread_runq(thread), thread); in runq_add() 84 static ALWAYS_INLINE void runq_remove(struct k_thread *thread) in runq_remove() argument 86 __ASSERT_NO_MSG(!z_is_idle_thread_object(thread)); in runq_remove() [all …]
|
D | thread_monitor.c | 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() 77 user_cb(thread, user_data); in k_thread_foreach_unlocked() [all …]
|
D | cpu_mask.c | 19 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 …]
|
D | float.c | 11 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 …]
|
D | timeslicing.c | 25 static inline int slice_time(struct k_thread *thread) in slice_time() argument 30 if (thread->base.slice_ticks != 0) { in slice_time() 31 ret = thread->base.slice_ticks; in slice_time() 34 ARG_UNUSED(thread); in slice_time() 39 bool thread_is_sliceable(struct k_thread *thread) in thread_is_sliceable() argument 41 bool ret = thread_is_preemptible(thread) in thread_is_sliceable() 42 && slice_time(thread) != 0 in thread_is_sliceable() 43 && !z_is_prio_higher(thread->base.prio, slice_max_prio) in thread_is_sliceable() 44 && !z_is_thread_prevented_from_running(thread) in thread_is_sliceable() 45 && !z_is_idle_thread_object(thread); in thread_is_sliceable() [all …]
|
D | usage.c | 61 static void sched_thread_update_usage(struct k_thread *thread, uint32_t cycles) in sched_thread_update_usage() argument 63 thread->base.usage.total += cycles; in sched_thread_update_usage() 66 thread->base.usage.current += cycles; in sched_thread_update_usage() 68 if (thread->base.usage.longest < thread->base.usage.current) { in sched_thread_update_usage() 69 thread->base.usage.longest = thread->base.usage.current; in sched_thread_update_usage() 74 void z_sched_usage_start(struct k_thread *thread) in z_sched_usage_start() argument 83 if (thread->base.usage.track_usage) { in z_sched_usage_start() 84 thread->base.usage.num_windows++; in z_sched_usage_start() 85 thread->base.usage.current = 0; in z_sched_usage_start() 173 void z_sched_thread_usage(struct k_thread *thread, in z_sched_thread_usage() argument [all …]
|
/Zephyr-latest/arch/x86/core/intel64/ |
D | thread.c | 13 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() 59 thread->arch.rdi = (long) entry; in arch_new_thread() 60 thread->arch.rsi = (long) p1; in arch_new_thread() [all …]
|
/Zephyr-latest/subsys/shell/modules/kernel_service/thread/ |
D | mask.c | 16 struct k_thread *thread; in cmd_kernel_thread_mask_clear() local 18 thread = UINT_TO_POINTER(shell_strtoull(argv[1], 16, &err)); in cmd_kernel_thread_mask_clear() 24 if (!z_thread_is_valid(thread)) { in cmd_kernel_thread_mask_clear() 25 shell_error(sh, "Invalid thread id %p", (void *)thread); in cmd_kernel_thread_mask_clear() 29 rc = k_thread_cpu_mask_clear(thread); in cmd_kernel_thread_mask_clear() 33 shell_print(sh, "%p %s cpu_mask: 0x%x", (void *)thread, thread->name, in cmd_kernel_thread_mask_clear() 34 thread->base.cpu_mask); in cmd_kernel_thread_mask_clear() 45 struct k_thread *thread; in cmd_kernel_thread_mask_enable_all() local 47 thread = UINT_TO_POINTER(shell_strtoull(argv[1], 16, &err)); in cmd_kernel_thread_mask_enable_all() 53 if (!z_thread_is_valid(thread)) { in cmd_kernel_thread_mask_enable_all() [all …]
|
D | pin.c | 17 struct k_thread *thread; in cmd_kernel_thread_pin() local 19 thread = UINT_TO_POINTER(shell_strtoull(argv[1], 16, &err)); in cmd_kernel_thread_pin() 25 if (!z_thread_is_valid(thread)) { in cmd_kernel_thread_pin() 26 shell_error(sh, "Invalid thread id %p", (void *)thread); in cmd_kernel_thread_pin() 36 shell_print(sh, "Pinning %p %s to CPU %d", (void *)thread, thread->name, cpu); in cmd_kernel_thread_pin() 37 err = k_thread_cpu_pin(thread, cpu); in cmd_kernel_thread_pin() 41 shell_print(sh, "%p %s cpu_mask: 0x%x", (void *)thread, thread->name, in cmd_kernel_thread_pin() 42 thread->base.cpu_mask); in cmd_kernel_thread_pin()
|
D | list.c | 14 static void rt_stats_dump(const struct shell *sh, struct k_thread *thread) in rt_stats_dump() argument 21 if (k_thread_runtime_stats_get(thread, &rt_stats_thread) != 0) { in rt_stats_dump() 64 struct k_thread *thread = (struct k_thread *)cthread; in shell_tdata_dump() local 68 size_t size = thread->stack_info.size; in shell_tdata_dump() 73 tname = k_thread_name_get(thread); in shell_tdata_dump() 76 (thread == k_current_get()) ? "*" : " ", in shell_tdata_dump() 77 thread, in shell_tdata_dump() 81 thread->base.user_options, in shell_tdata_dump() 82 thread->base.prio, in shell_tdata_dump() 83 (int64_t)thread->base.timeout.dticks); in shell_tdata_dump() [all …]
|
D | thread.c | 16 const struct k_thread *const thread; member 24 if (cthread == entry->thread) { in thread_valid_cb() 29 bool z_thread_is_valid(const struct k_thread *thread) in z_thread_is_valid() argument 32 .thread = thread, in z_thread_is_valid() 41 SHELL_SUBCMD_SET_CREATE(sub_kernel_thread, (thread)); 42 KERNEL_CMD_ADD(thread, &sub_kernel_thread, "Kernel threads.", NULL);
|
/Zephyr-latest/subsys/tracing/sysview/ |
D | sysview_config.c | 20 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-latest/arch/arc/core/ |
D | thread.c | 50 static bool is_user(struct k_thread *thread) in is_user() argument 52 return (thread->base.user_options & K_USER) != 0; in is_user() 57 static void setup_stack_vars(struct k_thread *thread) in setup_stack_vars() argument 60 if (is_user(thread)) { in setup_stack_vars() 62 thread->arch.priv_stack_start = in setup_stack_vars() 63 (uint32_t)z_priv_stack_find(thread->stack_obj); in setup_stack_vars() 65 thread->arch.priv_stack_start = (uint32_t)(thread->stack_obj); in setup_stack_vars() 67 thread->arch.priv_stack_start += Z_ARC_STACK_GUARD_SIZE; in setup_stack_vars() 69 thread->arch.priv_stack_start = 0; in setup_stack_vars() 75 if (is_user(thread)) { in setup_stack_vars() [all …]
|
/Zephyr-latest/arch/arm/core/cortex_a_r/ |
D | thread.c | 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() 113 thread->arch.basepri = 0; in arch_new_thread() 116 thread->arch.mode = 0; in arch_new_thread() [all …]
|
/Zephyr-latest/arch/arm/core/cortex_m/ |
D | thread.c | 60 void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack, char *stack_ptr, in arch_new_thread() argument 71 thread->stack_info.start += MPU_GUARD_ALIGN_AND_SIZE; in arch_new_thread() 72 thread->stack_info.size -= MPU_GUARD_ALIGN_AND_SIZE; in arch_new_thread() 76 if ((thread->base.user_options & K_FP_REGS) != 0) { in arch_new_thread() 82 thread->stack_info.start += FP_GUARD_EXTRA_SIZE; in arch_new_thread() 83 thread->stack_info.size -= FP_GUARD_EXTRA_SIZE; in arch_new_thread() 90 if ((thread->base.user_options & K_USER) != 0) { in arch_new_thread() 108 thread->callee_saved.psp = (uint32_t)iframe; in arch_new_thread() 109 thread->arch.basepri = 0; in arch_new_thread() 112 thread->arch.mode = 0; in arch_new_thread() [all …]
|
/Zephyr-latest/arch/sparc/core/ |
D | thread.c | 10 void z_thread_entry_wrapper(k_thread_entry_t thread, 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() 47 thread->callee_saved.psr = PSR_S | PSR_PS | PSR_ET; in arch_new_thread() [all …]
|
/Zephyr-latest/samples/kernel/condition_variables/condvar/ |
D | README.rst | 12 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-latest/arch/x86/core/ia32/ |
D | float.c | 131 static void FpCtxSave(struct k_thread *thread) in FpCtxSave() argument 134 if ((thread->base.user_options & K_SSE_REGS) != 0) { in FpCtxSave() 135 z_do_fp_and_sse_regs_save(&thread->arch.preempFloatReg); in FpCtxSave() 139 z_do_fp_regs_save(&thread->arch.preempFloatReg); in FpCtxSave() 148 static inline void FpCtxInit(struct k_thread *thread) in FpCtxInit() argument 152 if ((thread->base.user_options & K_SSE_REGS) != 0) { in FpCtxInit() 167 void z_float_enable(struct k_thread *thread, unsigned int options) in z_float_enable() argument 172 if (!thread) { in z_float_enable() 182 thread->base.user_options |= (uint8_t)options; in z_float_enable() 206 FpCtxInit(thread); in z_float_enable() [all …]
|
D | thread.c | 52 extern int z_float_disable(struct k_thread *thread); 54 int arch_float_disable(struct k_thread *thread) in arch_float_disable() argument 57 return z_float_disable(thread); in arch_float_disable() 63 extern int z_float_enable(struct k_thread *thread, unsigned int options); 65 int arch_float_enable(struct k_thread *thread, unsigned int options) in arch_float_enable() argument 68 return z_float_enable(thread, options); in arch_float_enable() 75 void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack, in arch_new_thread() argument 90 swap_entry = z_x86_userspace_prepare_thread(thread); in arch_new_thread() 115 thread->callee_saved.esp = (unsigned long)initial_frame; in arch_new_thread() 117 thread->arch.excNestCount = 0; in arch_new_thread() [all …]
|
/Zephyr-latest/subsys/tracing/test/ |
D | tracing_string_format_test.c | 16 struct k_thread *thread; in sys_trace_k_thread_switched_out() local 18 thread = k_current_get(); in sys_trace_k_thread_switched_out() 19 TRACING_STRING("%s: %p\n", __func__, thread); in sys_trace_k_thread_switched_out() 24 struct k_thread *thread; in sys_trace_k_thread_switched_in() local 26 thread = k_current_get(); in sys_trace_k_thread_switched_in() 27 TRACING_STRING("%s: %p\n", __func__, thread); in sys_trace_k_thread_switched_in() 30 void sys_trace_k_thread_priority_set(struct k_thread *thread) in sys_trace_k_thread_priority_set() argument 32 TRACING_STRING("%s: %p\n", __func__, thread); in sys_trace_k_thread_priority_set() 35 void sys_trace_k_thread_create(struct k_thread *thread, size_t stack_size, in sys_trace_k_thread_create() argument 38 TRACING_STRING("%s: %p\n", __func__, thread); in sys_trace_k_thread_create() [all …]
|
/Zephyr-latest/arch/posix/core/ |
D | thread.c | 32 void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack, in arch_new_thread() argument 53 thread->callee_saved.thread_status = thread_status; in arch_new_thread() 58 int arch_thread_name_set(struct k_thread *thread, const char *str) in arch_thread_name_set() argument 67 thread_status = thread->callee_saved.thread_status; in arch_thread_name_set() 100 int arch_float_disable(struct k_thread *thread) in arch_float_disable() argument 102 ARG_UNUSED(thread); in arch_float_disable() 108 int arch_float_enable(struct k_thread *thread, unsigned int options) in arch_float_enable() argument 110 ARG_UNUSED(thread); in arch_float_enable() 119 void z_impl_k_thread_abort(k_tid_t thread) in z_impl_k_thread_abort() argument 124 SYS_PORT_TRACING_OBJ_FUNC_ENTER(k_thread, abort, thread); in z_impl_k_thread_abort() [all …]
|
/Zephyr-latest/doc/kernel/services/threads/ |
D | system_threads.rst | 10 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 …]
|