doc ru, printf() before assert in containers

This commit is contained in:
2022-04-12 23:17:05 +03:00
parent 486fdf3dcd
commit 00830958df
18 changed files with 802 additions and 350 deletions

View File

@@ -35,20 +35,30 @@ class PIP_EXPORT PISpinlock
public:
NO_COPY_CLASS(PISpinlock)
//! Constructs unlocked spinlock
//! \~english Constructs unlocked spinlock
//! \~russian
explicit PISpinlock() {flag.clear();}
//! Destroy spinlock
//! \~english Destroy spinlock
//! \~russian
~PISpinlock() {}
//! \brief Lock spinlock
//! \details If spinlock is unlocked it set to locked state and returns immediate.
//! \~english Lock spinlock
//! \~russian
//! \~\details
//! \~english
//! If spinlock is unlocked it set to locked state and returns immediate.
//! If spinlock is already locked function blocks until spinlock will be unlocked
//! \~russian
void lock() {while (flag.test_and_set(std::memory_order_acquire));}
//! \brief Unlock spinlock
//! \details In any case this function returns immediate
//! \~english Unlock spinlock
//! \~russian
//! \~\details
//! \~english
//! In any case this function returns immediate
//! \~russian
void unlock() {flag.clear(std::memory_order_release);}
private:
@@ -57,22 +67,24 @@ private:
};
//! \brief PISpinlockLocker
//! \details
//! When a PISpinlockLocker object is created, it attempts to lock the spinlock it is given, if "condition" true.
//! When control leaves the scope in which the PISpinlockLocker object was created,
//! the PISpinlockLocker is destructed and the spinlock is released, if "condition" true.
//! If "condition" false this class do nothing.
//! The PISpinlockLocker class is non-copyable.
class PIP_EXPORT PISpinlockLocker
{
public:
NO_COPY_CLASS(PISpinlockLocker)
//! \~english Constructs and lock "s" if "condition" is \c true
//! \~russian
PISpinlockLocker(PISpinlock & s, bool condition = true): spinlock(s), cond(condition) {if (cond) spinlock.lock();}
//! \~english Unlock "s" if "condition" was \c true
//! \~russian
~PISpinlockLocker() {if (cond) spinlock.unlock();}
private:
PISpinlock & spinlock;
bool cond;
};
#endif // PISPINLOCK_H