This is an automated email from the ASF dual-hosted git repository.

ccollins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-mcumgr.git

commit 3e895c3fb6b771d2d5599e9fcc131470d410a41c
Author: Christopher Collins <ccoll...@apache.org>
AuthorDate: Fri Jan 26 15:47:32 2018 -0800

    Reboot in system workqueue, not ISR.
---
 cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c 
b/cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c
index 221da97..df996a8 100644
--- a/cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c
+++ b/cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c
@@ -26,10 +26,13 @@
 #include "os_mgmt/os_mgmt_impl.h"
 
 static void zephyr_os_mgmt_reset_cb(struct k_timer *timer);
+static void zephyr_os_mgmt_reset_work_handler(struct k_work *work);
 
 static K_TIMER_DEFINE(zephyr_os_mgmt_reset_timer,
                       zephyr_os_mgmt_reset_cb, NULL);
 
+K_WORK_DEFINE(zephyr_os_mgmt_reset_work, zephyr_os_mgmt_reset_work_handler);
+
 #ifdef CONFIG_THREAD_MONITOR
 static const struct k_thread *
 zephyr_os_mgmt_task_at(int idx)
@@ -72,11 +75,18 @@ os_mgmt_impl_task_info(int idx, struct os_mgmt_task_info 
*out_info)
 #endif /* CONFIG_THREAD_MONITOR */
 
 static void
-zephyr_os_mgmt_reset_cb(struct k_timer *timer)
+zephyr_os_mgmt_reset_work_handler(struct k_work *work)
 {
     sys_reboot(SYS_REBOOT_WARM);
 }
 
+static void
+zephyr_os_mgmt_reset_cb(struct k_timer *timer)
+{
+    /* Reboot the system from the system workqueue thread. */
+    k_work_submit(&zephyr_os_mgmt_reset_work);
+}
+
 int
 os_mgmt_impl_reset(unsigned int delay_ms)
 {

-- 
To stop receiving notification emails like this one, please contact
ccoll...@apache.org.

Reply via email to