From 82b5b94e24f178bfb11907091d459ca163cab5ba Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 8 Jan 2018 14:52:11 +1100 Subject: [PATCH] AP_IOMCU: fixed race condition on thread startup thread_ctx may not be set for first trigger_event() --- libraries/AP_IOMCU/AP_IOMCU.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libraries/AP_IOMCU/AP_IOMCU.cpp b/libraries/AP_IOMCU/AP_IOMCU.cpp index 2a75fab3ce..5f5cff9f72 100644 --- a/libraries/AP_IOMCU/AP_IOMCU.cpp +++ b/libraries/AP_IOMCU/AP_IOMCU.cpp @@ -140,6 +140,8 @@ void AP_IOMCU::event_failed(uint8_t event) */ void AP_IOMCU::thread_main(void) { + thread_ctx = chThdGetSelfX(); + // uart runs at 1.5MBit uart.begin(1500*1000, 256, 256); uart.set_blocking_writes(false);