From 09ac68bffd9545a4db118c1d2df5fd6ab0e43237 Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Thu, 8 May 2014 11:37:45 +0400 Subject: [PATCH] STM32: Proper semaphore destruction in NuttX driver --- .../stm32/driver/include/uavcan_stm32/thread.hpp | 3 ++- libuavcan_drivers/stm32/driver/src/uc_stm32_thread.cpp | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libuavcan_drivers/stm32/driver/include/uavcan_stm32/thread.hpp b/libuavcan_drivers/stm32/driver/include/uavcan_stm32/thread.hpp index 38ab49b74b..58c9fae21d 100644 --- a/libuavcan_drivers/stm32/driver/include/uavcan_stm32/thread.hpp +++ b/libuavcan_drivers/stm32/driver/include/uavcan_stm32/thread.hpp @@ -45,12 +45,13 @@ public: #elif UAVCAN_STM32_NUTTX -class Event +class Event : uavcan::Noncopyable { sem_t sem_; public: Event(); + ~Event(); bool wait(uavcan::MonotonicDuration duration); diff --git a/libuavcan_drivers/stm32/driver/src/uc_stm32_thread.cpp b/libuavcan_drivers/stm32/driver/src/uc_stm32_thread.cpp index bc4c2aa6c2..5d7a3382ff 100644 --- a/libuavcan_drivers/stm32/driver/src/uc_stm32_thread.cpp +++ b/libuavcan_drivers/stm32/driver/src/uc_stm32_thread.cpp @@ -62,6 +62,11 @@ Event::Event() (void)sem_init(&sem_, 0, 0); } +Event::~Event() +{ + (void)sem_destroy(&sem_); +} + bool Event::wait(uavcan::MonotonicDuration duration) { if (duration.isNegative())