deleted copyctor and copy assignment
This commit is contained in:
parent
338651af2f
commit
f6b17d6e2e
@ -15,27 +15,6 @@ BinarySemaphore::~BinarySemaphore() {
|
|||||||
vSemaphoreDelete(handle);
|
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) {
|
BinarySemaphore::BinarySemaphore(BinarySemaphore&& s) {
|
||||||
handle = xSemaphoreCreateBinary();
|
handle = xSemaphoreCreateBinary();
|
||||||
if(handle == nullptr) {
|
if(handle == nullptr) {
|
||||||
|
@ -39,10 +39,10 @@ public:
|
|||||||
|
|
||||||
//! @brief Default ctor
|
//! @brief Default ctor
|
||||||
BinarySemaphore();
|
BinarySemaphore();
|
||||||
//! @brief Copy ctor
|
//! @brief Copy ctor, deleted explicitely.
|
||||||
BinarySemaphore(const BinarySemaphore&);
|
BinarySemaphore(const BinarySemaphore&) = delete;
|
||||||
//! @brief Copy assignment
|
//! @brief Copy assignment, deleted explicitely.
|
||||||
BinarySemaphore& operator=(const BinarySemaphore&);
|
BinarySemaphore& operator=(const BinarySemaphore&) = delete;
|
||||||
//! @brief Move ctor
|
//! @brief Move ctor
|
||||||
BinarySemaphore (BinarySemaphore &&);
|
BinarySemaphore (BinarySemaphore &&);
|
||||||
//! @brief Move assignment
|
//! @brief Move assignment
|
||||||
|
Loading…
Reference in New Issue
Block a user