Home
last modified time | relevance | path

Searched refs:thread (Results 1 – 25 of 983) sorted by relevance

12345678910>>...40

/Zephyr-4.3.0/samples/kernel/condition_variables/simple/
DREADME.rst13 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-4.3.0/kernel/include/
Dkthread.h42 void z_thread_monitor_exit(struct k_thread *thread);
44 #define z_thread_monitor_exit(thread) \ argument
49 void z_thread_abort(struct k_thread *thread);
51 static inline void thread_schedule_new(struct k_thread *thread, k_timeout_t delay) in thread_schedule_new() argument
55 k_thread_start(thread); in thread_schedule_new()
57 z_add_thread_timeout(thread, delay); in thread_schedule_new()
61 k_thread_start(thread); in thread_schedule_new()
65 static inline int thread_is_preemptible(const struct k_thread *thread) in thread_is_preemptible() argument
68 return thread->base.preempt <= _PREEMPT_THRESHOLD; in thread_is_preemptible()
72 static inline int thread_is_metairq(const struct k_thread *thread) in thread_is_metairq() argument
[all …]
Dksched.h56 void z_unpend_thread_no_timeout(struct k_thread *thread);
60 void z_pend_thread(struct k_thread *thread, _wait_q_t *wait_q,
64 void z_unpend_thread(struct k_thread *thread);
66 bool z_thread_prio_set(struct k_thread *thread, int prio);
71 void z_sched_start(struct k_thread *thread);
72 void z_ready_thread(struct k_thread *thread);
76 bool thread_is_sliceable(struct k_thread *thread);
142 static ALWAYS_INLINE _wait_q_t *pended_on_thread(struct k_thread *thread) in pended_on_thread() argument
144 __ASSERT_NO_MSG(thread->base.pended_on); in pended_on_thread()
146 return thread->base.pended_on; in pended_on_thread()
[all …]
/Zephyr-4.3.0/kernel/
Dsched.c39 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()
80 __ASSERT_NO_MSG(!is_thread_dummy(thread)); in runq_add()
82 _priq_run_add(thread_runq(thread), thread); in runq_add()
85 static ALWAYS_INLINE void runq_remove(struct k_thread *thread) in runq_remove() argument
[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 …]
Dtimeslicing.c25 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 …]
Dusage.c61 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()
172 void z_sched_thread_usage(struct k_thread *thread, in z_sched_thread_usage() argument
[all …]
/Zephyr-4.3.0/arch/x86/core/intel64/
Dthread.c12 extern void x86_sse_init(struct k_thread *thread); /* in locore.S */
27 void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack, in arch_new_thread() argument
43 switch_entry = z_x86_userspace_prepare_thread(thread); in arch_new_thread()
44 thread->arch.cs = X86_KERNEL_CS; in arch_new_thread()
45 thread->arch.ss = X86_KERNEL_DS; in arch_new_thread()
51 thread->callee_saved.rsp = (long) iframe; in arch_new_thread()
52 thread->callee_saved.rip = (long) switch_entry; in arch_new_thread()
53 thread->callee_saved.rflags = EFLAGS_INITIAL; in arch_new_thread()
58 thread->arch.rdi = (long) entry; in arch_new_thread()
59 thread->arch.rsi = (long) p1; in arch_new_thread()
[all …]
/Zephyr-4.3.0/arch/arm/core/cortex_m/
Dthread.c50 static void setup_priv_stack(struct k_thread *thread) in setup_priv_stack() argument
53 thread->arch.priv_stack_start = (uint32_t)z_priv_stack_find(thread->stack_obj); in setup_priv_stack()
59 thread->arch.priv_stack_end = thread->arch.priv_stack_start + CONFIG_PRIVILEGED_STACK_SIZE; in setup_priv_stack()
67 thread->arch.priv_stack_start += in setup_priv_stack()
68 ((thread->arch.mode & Z_ARM_MODE_MPU_GUARD_FLOAT_Msk) != 0) in setup_priv_stack()
72 thread->arch.priv_stack_start += MPU_GUARD_ALIGN_AND_SIZE; in setup_priv_stack()
90 void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack, char *stack_ptr, in arch_new_thread() argument
101 thread->stack_info.start += MPU_GUARD_ALIGN_AND_SIZE; in arch_new_thread()
102 thread->stack_info.size -= MPU_GUARD_ALIGN_AND_SIZE; in arch_new_thread()
106 if ((thread->base.user_options & K_FP_REGS) != 0) { in arch_new_thread()
[all …]
/Zephyr-4.3.0/arch/arm/core/cortex_a_r/
Dthread.c42 static void setup_priv_stack(struct k_thread *thread) in setup_priv_stack() argument
45 thread->arch.priv_stack_start = (uint32_t)z_priv_stack_find(thread->stack_obj); in setup_priv_stack()
51 thread->arch.priv_stack_end = thread->arch.priv_stack_start + CONFIG_PRIVILEGED_STACK_SIZE; in setup_priv_stack()
59 thread->arch.priv_stack_start += in setup_priv_stack()
60 ((thread->arch.mode & Z_ARM_MODE_MPU_GUARD_FLOAT_Msk) != 0) ? in setup_priv_stack()
63 thread->arch.priv_stack_start += MPU_GUARD_ALIGN_AND_SIZE; in setup_priv_stack()
81 void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack, in arch_new_thread() argument
93 thread->stack_info.start += MPU_GUARD_ALIGN_AND_SIZE; in arch_new_thread()
94 thread->stack_info.size -= MPU_GUARD_ALIGN_AND_SIZE; in arch_new_thread()
98 if ((thread->base.user_options & K_FP_REGS) != 0) { in arch_new_thread()
[all …]
/Zephyr-4.3.0/subsys/shell/modules/kernel_service/thread/
Dmask.c16 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 …]
Dpin.c17 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()
Dlist.c14 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 …]
/Zephyr-4.3.0/arch/sparc/core/
Dthread.c10 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-4.3.0/arch/arc/core/
Dthread.c50 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-4.3.0/subsys/tracing/sysview/
Dsysview_config.c24 static void set_thread_name(char *name, struct k_thread *thread) in set_thread_name() argument
26 const char *tname = k_thread_name_get(thread); in set_thread_name()
33 thread, &thread->entry); in set_thread_name()
37 void sys_trace_thread_info(struct k_thread *thread) in sys_trace_thread_info() argument
41 set_thread_name(name, thread); in sys_trace_thread_info()
45 Info.TaskID = (uint32_t)(uintptr_t)thread; in sys_trace_thread_info()
47 Info.Prio = thread->base.prio; in sys_trace_thread_info()
48 Info.StackBase = thread->stack_info.size; in sys_trace_thread_info()
49 Info.StackSize = thread->stack_info.start; in sys_trace_thread_info()
85 struct k_thread *thread; in send_task_list_cb() local
[all …]
/Zephyr-4.3.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-4.3.0/arch/x86/core/ia32/
Dfloat.c131 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 …]
Dthread.c51 extern int z_float_disable(struct k_thread *thread);
53 int arch_float_disable(struct k_thread *thread) in arch_float_disable() argument
56 return z_float_disable(thread); in arch_float_disable()
62 extern int z_float_enable(struct k_thread *thread, unsigned int options);
64 int arch_float_enable(struct k_thread *thread, unsigned int options) in arch_float_enable() argument
67 return z_float_enable(thread, options); in arch_float_enable()
74 int arch_coprocessors_disable(struct k_thread *thread) in arch_coprocessors_disable() argument
77 return arch_float_disable(thread); in arch_coprocessors_disable()
83 void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack, in arch_new_thread() argument
98 swap_entry = z_x86_userspace_prepare_thread(thread); in arch_new_thread()
[all …]
/Zephyr-4.3.0/arch/x86/core/
Dcet.c30 extern void arch_shadow_stack_reset(k_tid_t thread);
33 int arch_thread_hw_shadow_stack_attach(k_tid_t thread, in arch_thread_hw_shadow_stack_attach() argument
39 LOG_ERR("Can't set NULL shadow stack for thread %p\n", thread); in arch_thread_hw_shadow_stack_attach()
44 if (thread->arch.shstk_addr != NULL) { in arch_thread_hw_shadow_stack_attach()
47 if (thread->arch.shstk_base == stack && in arch_thread_hw_shadow_stack_attach()
48 thread->arch.shstk_size == stack_size) { in arch_thread_hw_shadow_stack_attach()
52 arch_shadow_stack_reset(thread); in arch_thread_hw_shadow_stack_attach()
58 LOG_ERR("Shadow stack already set up for thread %p\n", thread); in arch_thread_hw_shadow_stack_attach()
62 thread->arch.shstk_addr = stack + (stack_size - in arch_thread_hw_shadow_stack_attach()
64 thread->arch.shstk_size = stack_size; in arch_thread_hw_shadow_stack_attach()
[all …]
/Zephyr-4.3.0/arch/xtensa/core/
Dthread.c38 static void *init_stack(struct k_thread *thread, int *stack_top, in init_stack() argument
45 thread->arch.psp = NULL; in init_stack()
54 thread->arch.last_cpu = -1; in init_stack()
73 thread->arch.return_ps = PS_WOE | PS_UM | PS_CALLINC(1); in init_stack()
75 if ((thread->base.user_options & K_USER) == K_USER) { in init_stack()
87 frame->bsa.threadptr = thread->tls; in init_stack()
89 frame->bsa.threadptr = (uintptr_t)((thread->base.user_options & K_USER) ? thread : NULL); in init_stack()
117 void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack, in arch_new_thread() argument
121 thread->switch_handle = init_stack(thread, (int *)stack_ptr, entry, in arch_new_thread()
124 memset(thread->arch.hifi_regs, 0, sizeof(thread->arch.hifi_regs)); in arch_new_thread()
[all …]
/Zephyr-4.3.0/arch/posix/core/
Dthread.c32 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()
118 int arch_coprocessors_disable(struct k_thread *thread) in arch_coprocessors_disable() argument
125 void z_impl_k_thread_abort(k_tid_t thread) in z_impl_k_thread_abort() argument
[all …]
/Zephyr-4.3.0/arch/arm64/core/
Dthread.c79 static bool is_user(struct k_thread *thread) in is_user() argument
81 return (thread->base.user_options & K_USER) != 0; in is_user()
85 void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack, in arch_new_thread() argument
96 memset(&thread->arch, 0, sizeof(thread->arch)); in arch_new_thread()
123 if (is_user(thread)) { in arch_new_thread()
137 thread->arch.exception_depth = 1; in arch_new_thread()
144 thread->callee_saved.sp_elx = (uint64_t)pInitCtx; in arch_new_thread()
145 thread->callee_saved.lr = (uint64_t)z_arm64_exit_exc; in arch_new_thread()
147 thread->switch_handle = thread; in arch_new_thread()
149 thread->arch.stack_limit = (uint64_t)stack + Z_ARM64_STACK_GUARD_SIZE; in arch_new_thread()
[all …]
/Zephyr-4.3.0/modules/lvgl/
Dlvgl_zephyr_osal.c18 static void thread_entry(void *thread, void *cb, void *user_data);
20 lv_result_t lv_thread_init(lv_thread_t *thread, const char *const name, lv_thread_prio_t prio, in lv_thread_init() argument
25 thread->stack = k_thread_stack_alloc(stack_size, 0); in lv_thread_init()
26 if (thread->stack == NULL) { in lv_thread_init()
33 thread->tid = k_thread_create(&thread->thread, thread->stack, stack_size, thread_entry, in lv_thread_init()
34 thread, callback, user_data, thread_priority, 0, K_NO_WAIT); in lv_thread_init()
36 k_thread_name_set(thread->tid, name); in lv_thread_init()
41 lv_result_t lv_thread_delete(lv_thread_t *thread) in lv_thread_delete() argument
45 if (thread == NULL || thread->tid == NULL) { in lv_thread_delete()
50 ret = k_thread_join(&thread->thread, K_MSEC(100)); in lv_thread_delete()
[all …]

12345678910>>...40