From f6b17d6e2ea6156d06214937c70bee305707a836 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Wed, 20 May 2020 12:50:56 +0200 Subject: [PATCH] deleted copyctor and copy assignment --- osal/FreeRTOS/BinarySemaphore.cpp | 21 --------------------- osal/FreeRTOS/BinarySemaphore.h | 8 ++++---- 2 files changed, 4 insertions(+), 25 deletions(-) diff --git a/osal/FreeRTOS/BinarySemaphore.cpp b/osal/FreeRTOS/BinarySemaphore.cpp index c4a363b4..026704d6 100644 --- a/osal/FreeRTOS/BinarySemaphore.cpp +++ b/osal/FreeRTOS/BinarySemaphore.cpp @@ -15,27 +15,6 @@ BinarySemaphore::~BinarySemaphore() { vSemaphoreDelete(handle); } -// This copy ctor is important as it prevents the assignment to a ressource -// (other.handle) variable which is later deleted! -BinarySemaphore::BinarySemaphore(const BinarySemaphore& other) { - handle = xSemaphoreCreateBinary(); - if(handle == nullptr) { - sif::error << "Binary semaphore creation failure" << std::endl; - } - xSemaphoreGive(handle); -} - -BinarySemaphore& BinarySemaphore::operator =(const BinarySemaphore& s) { - if(this != &s) { - handle = xSemaphoreCreateBinary(); - if(handle == nullptr) { - sif::error << "Binary semaphore creation failure" << std::endl; - } - xSemaphoreGive(handle); - } - return *this; -} - BinarySemaphore::BinarySemaphore(BinarySemaphore&& s) { handle = xSemaphoreCreateBinary(); if(handle == nullptr) { diff --git a/osal/FreeRTOS/BinarySemaphore.h b/osal/FreeRTOS/BinarySemaphore.h index 0c9c0992..5f69dc90 100644 --- a/osal/FreeRTOS/BinarySemaphore.h +++ b/osal/FreeRTOS/BinarySemaphore.h @@ -39,10 +39,10 @@ public: //! @brief Default ctor BinarySemaphore(); - //! @brief Copy ctor - BinarySemaphore(const BinarySemaphore&); - //! @brief Copy assignment - BinarySemaphore& operator=(const BinarySemaphore&); + //! @brief Copy ctor, deleted explicitely. + BinarySemaphore(const BinarySemaphore&) = delete; + //! @brief Copy assignment, deleted explicitely. + BinarySemaphore& operator=(const BinarySemaphore&) = delete; //! @brief Move ctor BinarySemaphore (BinarySemaphore &&); //! @brief Move assignment