remove picout

This commit is contained in:
2026-03-17 18:34:48 +03:00
parent ac877f1024
commit 9f57f0107e
2 changed files with 8 additions and 18 deletions

View File

@@ -25,7 +25,6 @@
#ifndef PIPROTECTEDVARIABLE_H #ifndef PIPROTECTEDVARIABLE_H
#define PIPROTECTEDVARIABLE_H #define PIPROTECTEDVARIABLE_H
#include "picout.h"
#include "pimutex.h" #include "pimutex.h"
//! \~\ingroup Thread //! \~\ingroup Thread
@@ -35,6 +34,8 @@
template<typename T> template<typename T>
class PIP_EXPORT PIProtectedVariable { class PIP_EXPORT PIProtectedVariable {
public: public:
//! \~english Constructs %PIProtectedVariable and initialize variable by value `v`.
//! \~russian Создает %PIProtectedVariable и инициализирует переменную значением `v`.
PIProtectedVariable(T v = T()): var(std::move(v)) {} PIProtectedVariable(T v = T()): var(std::move(v)) {}
//! \~\brief //! \~\brief
@@ -43,26 +44,18 @@ public:
class PIP_EXPORT Pointer { class PIP_EXPORT Pointer {
friend class PIProtectedVariable<T>; friend class PIProtectedVariable<T>;
NO_COPY_CLASS(Pointer); NO_COPY_CLASS(Pointer);
Pointer & operator=(Pointer && other) = delete;
public: public:
//! \~\english Move constructor - transfers ownership of the lock. //! \~english Move constructor - transfers ownership of the lock.
//! \~russian Конструктор перемещения - передает владение блокировкой. //! \~russian Конструктор перемещения - передает владение блокировкой.
Pointer(Pointer && other): pv(other.pv) { other.can_unlock = false; }; Pointer(Pointer && other): pv(other.pv) { other.can_unlock = false; };
//! \~english Destroys wrapper and releases the mutex.
//! \~\english Move assignment - transfers ownership of the lock.
//! \~russian Оператор перемещения - передает владение блокировкой.
Pointer & operator=(Pointer && other) {
pv = other.pv;
other.can_unlock = false;
};
//! \~\english Destroys wrapper and releases the mutex.
//! \~russian Уничтожает обертку и освобождает мьютекс. //! \~russian Уничтожает обертку и освобождает мьютекс.
~Pointer() { ~Pointer() {
if (can_unlock) { if (can_unlock) {
pv.mutex.unlock(); pv.mutex.unlock();
piCout << "mutex.unlock()" << &(pv.mutex);
} }
} }
@@ -76,10 +69,7 @@ public:
private: private:
explicit Pointer() = delete; explicit Pointer() = delete;
explicit Pointer(PIProtectedVariable<T> & v): pv(v) { explicit Pointer(PIProtectedVariable<T> & v): pv(v) { pv.mutex.lock(); }
pv.mutex.lock();
piCout << "mutex.lock()" << &(pv.mutex);
}
PIProtectedVariable<T> & pv; PIProtectedVariable<T> & pv;
bool can_unlock = true; bool can_unlock = true;