Skip to content

Commit 6588cbd

Browse files
committed
cores: Remove redundant k_thread_start() calls for static threads.
According to Zephyr documentation, k_thread_create() both initializes and starts the thread. The second loop that was calling k_thread_start() on each static thread was redundant. Signed-off-by: iabdalkader <[email protected]>
1 parent ff55f69 commit 6588cbd

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

cores/arduino/threads.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ void start_static_threads() {
1111
#define _FOREACH_STATIC_THREAD(thread_data) \
1212
STRUCT_SECTION_FOREACH (_static_thread_data, thread_data)
1313

14+
extern void k_thread_test_static(void *thread);
15+
1416
_FOREACH_STATIC_THREAD(thread_data) {
1517
k_thread_create(thread_data->init_thread, thread_data->init_stack,
1618
thread_data->init_stack_size, thread_data->init_entry, thread_data->init_p1,
@@ -19,15 +21,5 @@ void start_static_threads() {
1921
k_thread_name_set(thread_data->init_thread, thread_data->init_name);
2022
thread_data->init_thread->init_data = thread_data;
2123
}
22-
23-
/*
24-
* Take a sched lock to prevent them from running
25-
* until they are all started.
26-
*/
27-
k_sched_lock();
28-
_FOREACH_STATIC_THREAD(thread_data) {
29-
k_thread_start(thread_data->init_thread);
30-
}
31-
k_sched_unlock();
3224
}
3325
#endif

0 commit comments

Comments
 (0)