thread doc ru

This commit is contained in:
2022-04-21 22:26:49 +03:00
parent 93b881da1b
commit 9deae168a6
7 changed files with 468 additions and 97 deletions

View File

@@ -31,13 +31,20 @@
//! \~russian \section PIMutex_sec0 Краткий обзор
//!
//! \~english
//! %PIMutex provides synchronization blocks between several threads.
//! %PIMutex provides critical code section defence between several threads.
//! Using mutex guarantees execution of some code only one of threads.
//! Mutex contains logic state and functions to change it: \a lock(),
//! \a unlock() and \a tryLock().
//!
//! \~russian
//! For automatic lock-unlock use \a PIMutexLocker.
//!
//! \~russian
//! %PIMutex предоставляет межпотоковую защиту критических секций кода.
//! Использование мьютекса гарантирует выполнение секции только один потоком.
//! Мьютекс состоит из логического состояния и методов для его изменения:
//! \a lock(), \a unlock() and \a tryLock().
//!
//! Для автоматической блокировки-разблокировки используйте \a PIMutexLocker.
//!
//! \~english \section PIMutex_sec1 Usage
//! \~russian \section PIMutex_sec1 Использование
@@ -47,11 +54,15 @@
//! should to be started with \a lock() and finished with \a unlock().
//!
//! \~russian
//! Части кода, которые должны быть выполнены только одним потоком в любой момент
//! времени должны начинаться с вызова \a lock() и заканчиваться вызовом \a unlock().
//!
//! \~\code
//! // critical section start
//! mutex.lock();
//! // ... your code here
//! mutex.unlock();
//! // critical section end
//! \endcode
//! \}
@@ -68,14 +79,31 @@
//! \~\details
//!
//! \~english
//! When a PIMutexLocker object is created, it attempts to lock the mutex it is given, if "condition" true.
//! When control leaves the scope in which the PIMutexLocker object was created,
//! the PIMutexLocker is destructed and the mutex is released, if "condition" true.
//! If "condition" false this class do nothing.
//! The PIMutexLocker class is non-copyable.
//! When a %PIMutexLocker object is created, it attempts to lock the mutex it is given, if "condition" \c true.
//! When control leaves the scope in which the %PIMutexLocker object was created,
//! the %PIMutexLocker is destructed and the mutex is released, if "condition" was \c true.
//!
//! If "condition" \c false this class do nothing.
//!
//! The %PIMutexLocker class is non-copyable.
//!
//! \~russian
//! При создании экземпляра %PIMutexLocker блокируется переданный мьютекс, если "condition" \c true.
//! Когда выполнение покидает область жизни объекта, вызывается его деструктор и мьютекс
//! разблокируется, если "condition" был \c true.
//!
//! Если "condition" \c false, то этот объект ничего не делает.
//!
//! Класс %PIMutexLocker некопируемый.
//!
//! \~\code
//! // critical section start
//! {
//! PIMutexLocker locker(mutex);
//! // ... your code here
//! }
//! // critical section end
//! \endcode
//! \}
@@ -118,6 +146,8 @@ PIMutex::~PIMutex() {
//! If mutex is unlocked it set to locked state and returns immediate.
//! If mutex is already locked function blocks until mutex will be unlocked
//! \~russian
//! Если мьютекс свободен, то блокирует его и возвращает управление немедленно.
//! Если мьютекс заблокирован, то ожидает разблокировки, затем блокирует и возвращает управление
void PIMutex::lock() {
#if defined(WINDOWS)
EnterCriticalSection(&(PRIVATE->mutex));
@@ -133,6 +163,7 @@ void PIMutex::lock() {
//! \~english
//! In any case this function returns immediate
//! \~russian
//! В любом случае возвращает управление немедленно
void PIMutex::unlock() {
#if defined(WINDOWS)
LeaveCriticalSection(&(PRIVATE->mutex));