Files
pip/libs/main/thread/pispinlock.cpp

66 lines
1.9 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
PIP - Platform Independent Primitives
PISpinlock
Ivan Pelipenko peri4ko@yandex.ru
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
//! \addtogroup Thread
//! \{
//! \class PISpinlock pispinlock.h
//!
//! \~\brief
//! \~english Fast and full-load lock
//! \~russian Быстрая блокировка с полной нагрузкой
//!
//! \~\details
//! \~english
//! %PISpinlock provides synchronization blocks between several threads.
//! PISpinlock functionality similar to PIMutex, but working on atomic
//! type and \a lock() method wait with 100% CPU load.
//!
//! \~russian
//!
//! \~\note
//! \~english
//! Use this type instead of PIMutex when less waiting time is more
//! important than CPU load!
//!
//! \~russian
//!
//! \}
//! \addtogroup Thread
//! \{
//! \class PISpinlockLocker pispinlock.h
//!
//! \~\brief
//! \~english %PISpinlock autolocker
//! \~russian
//!
//!
//! \~\details
//! \~english
//! 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.
//!
//! \~russian
//!
//! \}