kernel: Add static threads to k_thread_foreach functions

Add iterating over the static threads for k_thread_foreach and
k_thread_foreach_unlocked iterator functions

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
diff --git a/kernel/thread.c b/kernel/thread.c
index b0d11e7..a5cebe3 100644
--- a/kernel/thread.c
+++ b/kernel/thread.c
@@ -55,9 +55,15 @@
 	 * k_thread_abort from user_cb.
 	 */
 	key = k_spin_lock(&z_thread_monitor_lock);
+
+	_FOREACH_STATIC_THREAD(thread_data) {
+		user_cb(thread_data->init_thread, user_data);
+	}
+
 	for (thread = _kernel.threads; thread; thread = thread->next_thread) {
 		user_cb(thread, user_data);
 	}
+
 	k_spin_unlock(&z_thread_monitor_lock, key);
 #endif
 }
@@ -71,11 +77,19 @@
 	__ASSERT(user_cb != NULL, "user_cb can not be NULL");
 
 	key = k_spin_lock(&z_thread_monitor_lock);
+
+	_FOREACH_STATIC_THREAD(thread_data) {
+		k_spin_unlock(&z_thread_monitor_lock, key);
+		user_cb(thread_data->init_thread, user_data);
+		key = k_spin_lock(&z_thread_monitor_lock);
+	}
+
 	for (thread = _kernel.threads; thread; thread = thread->next_thread) {
 		k_spin_unlock(&z_thread_monitor_lock, key);
 		user_cb(thread, user_data);
 		key = k_spin_lock(&z_thread_monitor_lock);
 	}
+
 	k_spin_unlock(&z_thread_monitor_lock, key);
 #endif
 }