mirror of
https://github.com/ETLCPP/etl.git
synced 2026-04-30 19:09:10 +08:00
finish reverting the locked queues
This commit is contained in:
parent
6bc775ba99
commit
47526dfe89
@ -273,7 +273,6 @@ namespace etl
|
||||
///\details Normally a reference to this type will be taken from a derived queue_lockable.
|
||||
/// This queue supports concurrent access by one producer and one consumer.
|
||||
/// \tparam T The type of value that the queue_lockable holds.
|
||||
/// \note T must have a copy constructor defined, as front() returns by value.
|
||||
//***************************************************************************
|
||||
template <typename T, const size_t VMemory_Model = etl::memory_model::MEMORY_MODEL_LARGE>
|
||||
class iqueue_lockable : public etl::queue_lockable_base<VMemory_Model>
|
||||
@ -285,7 +284,6 @@ namespace etl
|
||||
public:
|
||||
|
||||
typedef T value_type; ///< The type stored in the queue.
|
||||
typedef const T const_value_type; ///< A const value of the type used in the queue.
|
||||
typedef T& reference; ///< A reference to the type used in the queue.
|
||||
typedef const T& const_reference; ///< A const reference to the type used in the queue.
|
||||
#if ETL_USING_CPP11
|
||||
@ -544,7 +542,7 @@ namespace etl
|
||||
/// Peek a value at the front of the queue.
|
||||
/// If asserts or exceptions are enabled, throws an etl::queue_lockable_empty if the queue is empty.
|
||||
//*************************************************************************
|
||||
value_type front()
|
||||
reference front()
|
||||
{
|
||||
#if ETL_CHECKING_EXTRA
|
||||
this->lock();
|
||||
@ -572,7 +570,7 @@ namespace etl
|
||||
/// Peek a value at the front of the queue.
|
||||
/// If asserts or exceptions are enabled, throws an etl::queue_lockable_empty if the queue is empty.
|
||||
//*************************************************************************
|
||||
const_value_type front() const
|
||||
const_reference front() const
|
||||
{
|
||||
#if ETL_CHECKING_EXTRA
|
||||
this->lock();
|
||||
@ -644,22 +642,6 @@ namespace etl
|
||||
|
||||
private:
|
||||
|
||||
//*************************************************************************
|
||||
/// Mutex-compatible adapter that bridges the virtual lock/unlock methods
|
||||
/// to the interface expected by etl::lock_guard.
|
||||
//*************************************************************************
|
||||
class lock_adapter
|
||||
{
|
||||
public:
|
||||
explicit lock_adapter(const iqueue_lockable& q_) : q(q_) {}
|
||||
void lock() { q.lock(); }
|
||||
void unlock() { q.unlock(); }
|
||||
private:
|
||||
lock_adapter(const lock_adapter&) ETL_DELETE;
|
||||
lock_adapter& operator=(const lock_adapter&) ETL_DELETE;
|
||||
const iqueue_lockable& q;
|
||||
};
|
||||
|
||||
//*************************************************************************
|
||||
/// Push a value to the queue without locking.
|
||||
//*************************************************************************
|
||||
@ -889,7 +871,6 @@ namespace etl
|
||||
/// \tparam T The type this queue should support.
|
||||
/// \tparam VSize The maximum capacity of the queue.
|
||||
/// \tparam VMemory_Model The memory model for the queue. Determines the type of the internal counter variables.
|
||||
/// \note T must have a copy constructor defined, as front() returns by value.
|
||||
//***************************************************************************
|
||||
template <typename T, size_t VSize, size_t VMemory_Model = etl::memory_model::MEMORY_MODEL_LARGE>
|
||||
class queue_lockable : public etl::iqueue_lockable<T, VMemory_Model>
|
||||
|
||||
@ -156,7 +156,6 @@ namespace etl
|
||||
///\endcode
|
||||
/// This queue supports concurrent access by one producer and one consumer.
|
||||
/// \tparam T The type of value that the queue_mpmc_mutex holds.
|
||||
/// \note T must have a copy constructor defined, as front() returns by value.
|
||||
//***************************************************************************
|
||||
template <typename T, const size_t MEMORY_MODEL = etl::memory_model::MEMORY_MODEL_LARGE>
|
||||
class iqueue_mpmc_mutex : public queue_mpmc_mutex_base<MEMORY_MODEL>
|
||||
@ -168,7 +167,6 @@ namespace etl
|
||||
public:
|
||||
|
||||
typedef T value_type; ///< The type stored in the queue.
|
||||
typedef const T const_value_type; ///< A const value of the type used in the queue.
|
||||
typedef T& reference; ///< A reference to the type used in the queue.
|
||||
typedef const T& const_reference; ///< A const reference to the type used in the queue.
|
||||
#if ETL_USING_CPP11
|
||||
@ -341,7 +339,7 @@ namespace etl
|
||||
/// Peek a value at the front of the queue.
|
||||
/// If asserts or exceptions are enabled, throws an etl::queue_mpmc_empty if the queue is empty.
|
||||
//*************************************************************************
|
||||
value_type front()
|
||||
reference front()
|
||||
{
|
||||
#if ETL_CHECKING_EXTRA
|
||||
access.lock();
|
||||
@ -369,7 +367,7 @@ namespace etl
|
||||
/// Peek a value at the front of the queue.
|
||||
/// If asserts or exceptions are enabled, throws an etl::queue_mpmc_empty if the queue is empty.
|
||||
//*************************************************************************
|
||||
const_value_type front() const
|
||||
const_reference front() const
|
||||
{
|
||||
#if ETL_CHECKING_EXTRA
|
||||
access.lock();
|
||||
@ -731,7 +729,6 @@ namespace etl
|
||||
/// \tparam T The type this queue should support.
|
||||
/// \tparam SIZE The maximum capacity of the queue.
|
||||
/// \tparam MEMORY_MODEL The memory model for the queue. Determines the type of the internal counter variables.
|
||||
/// \note T must have a copy constructor defined, as front() returns by value.
|
||||
//***************************************************************************
|
||||
template <typename T, size_t SIZE, const size_t MEMORY_MODEL = etl::memory_model::MEMORY_MODEL_LARGE>
|
||||
class queue_mpmc_mutex : public etl::iqueue_mpmc_mutex<T, MEMORY_MODEL>
|
||||
|
||||
@ -82,7 +82,6 @@ namespace etl
|
||||
typedef typename etl::size_type_lookup<MEMORY_MODEL>::type size_type;
|
||||
|
||||
typedef T value_type; ///< The type stored in the queue.
|
||||
typedef const T const_value_type; ///< A const value of the type used in the queue.
|
||||
typedef T& reference; ///< A reference to the type used in the queue.
|
||||
typedef const T& const_reference; ///< A const reference to the type used in the queue.
|
||||
#if ETL_USING_CPP11
|
||||
@ -520,7 +519,6 @@ namespace etl
|
||||
///\endcode
|
||||
/// This queue supports concurrent access by one producer and one consumer.
|
||||
/// \tparam T The type of value that the queue_spsc_isr holds.
|
||||
/// \note T must have a copy constructor defined, as front() returns by value.
|
||||
//***************************************************************************
|
||||
template <typename T, typename TAccess, const size_t MEMORY_MODEL = etl::memory_model::MEMORY_MODEL_LARGE>
|
||||
class iqueue_spsc_isr : public queue_spsc_isr_base<T, MEMORY_MODEL>
|
||||
@ -532,7 +530,6 @@ namespace etl
|
||||
public:
|
||||
|
||||
typedef typename base_t::value_type value_type; ///< The type stored in the queue.
|
||||
typedef typename base_t::const_value_type const_value_type; ///< A const value of the type used in the queue.
|
||||
typedef typename base_t::reference reference; ///< A reference to the type used in the queue.
|
||||
typedef typename base_t::const_reference const_reference; ///< A const reference to the type used in the queue.
|
||||
#if ETL_USING_CPP11
|
||||
@ -699,7 +696,7 @@ namespace etl
|
||||
/// Peek a value at the front of the queue.
|
||||
/// If asserts or exceptions are enabled, throws an etl::queue_spsc_isr_empty if the queue is empty.
|
||||
//*************************************************************************
|
||||
value_type front()
|
||||
reference front()
|
||||
{
|
||||
#if ETL_CHECKING_EXTRA
|
||||
TAccess::lock();
|
||||
@ -727,7 +724,7 @@ namespace etl
|
||||
/// Peek a value at the front of the queue.
|
||||
/// If asserts or exceptions are enabled, throws an etl::queue_spsc_isr_empty if the queue is empty.
|
||||
//*************************************************************************
|
||||
const_value_type front() const
|
||||
const_reference front() const
|
||||
{
|
||||
#if ETL_CHECKING_EXTRA
|
||||
TAccess::lock();
|
||||
@ -843,21 +840,6 @@ namespace etl
|
||||
|
||||
private:
|
||||
|
||||
//*************************************************************************
|
||||
/// Mutex-compatible adapter that bridges the static TAccess lock/unlock
|
||||
/// methods to the interface expected by etl::lock_guard.
|
||||
//*************************************************************************
|
||||
class isr_lock_adapter
|
||||
{
|
||||
public:
|
||||
isr_lock_adapter() {}
|
||||
void lock() { TAccess::lock(); }
|
||||
void unlock() { TAccess::unlock(); }
|
||||
private:
|
||||
isr_lock_adapter(const isr_lock_adapter&) ETL_DELETE;
|
||||
isr_lock_adapter& operator=(const isr_lock_adapter&) ETL_DELETE;
|
||||
};
|
||||
|
||||
// Disable copy construction and assignment.
|
||||
iqueue_spsc_isr(const iqueue_spsc_isr&) ETL_DELETE;
|
||||
iqueue_spsc_isr& operator =(const iqueue_spsc_isr&) ETL_DELETE;
|
||||
@ -878,7 +860,6 @@ namespace etl
|
||||
/// \tparam SIZE The maximum capacity of the queue.
|
||||
/// \tparam TAccess The type that will lock and unlock interrupts.
|
||||
/// \tparam MEMORY_MODEL The memory model for the queue. Determines the type of the internal counter variables.
|
||||
/// \note T must have a copy constructor defined, as front() returns by value.
|
||||
//***************************************************************************
|
||||
template <typename T, size_t SIZE, typename TAccess, const size_t MEMORY_MODEL = etl::memory_model::MEMORY_MODEL_LARGE>
|
||||
class queue_spsc_isr : public etl::iqueue_spsc_isr<T, TAccess, MEMORY_MODEL>
|
||||
|
||||
@ -228,7 +228,6 @@ namespace etl
|
||||
public:
|
||||
|
||||
typedef T value_type; ///< The type stored in the queue.
|
||||
typedef const T const_value_type; ///< A const value of the type used in the queue.
|
||||
typedef T& reference; ///< A reference to the type used in the queue.
|
||||
typedef const T& const_reference; ///< A const reference to the type used in the queue.
|
||||
#if ETL_USING_CPP11
|
||||
@ -499,7 +498,7 @@ namespace etl
|
||||
/// Peek a value from the front of the queue.
|
||||
/// If asserts or exceptions are enabled, throws an etl::queue_spsc_locked_empty if the queue is empty.
|
||||
//*************************************************************************
|
||||
value_type front()
|
||||
reference front()
|
||||
{
|
||||
#if ETL_CHECKING_EXTRA
|
||||
lock();
|
||||
@ -527,7 +526,7 @@ namespace etl
|
||||
/// Peek a value from the front of the queue.
|
||||
/// If asserts or exceptions are enabled, throws an etl::queue_spsc_locked_empty if the queue is empty.
|
||||
//*************************************************************************
|
||||
const_value_type front() const
|
||||
const_reference front() const
|
||||
{
|
||||
#if ETL_CHECKING_EXTRA
|
||||
lock();
|
||||
@ -657,30 +656,6 @@ namespace etl
|
||||
|
||||
private:
|
||||
|
||||
//*************************************************************************
|
||||
/// Mutex-compatible adapter that bridges the lock/unlock ifunction
|
||||
/// callbacks to the interface expected by etl::lock_guard.
|
||||
//*************************************************************************
|
||||
class lock_adapter
|
||||
{
|
||||
public:
|
||||
lock_adapter(const etl::ifunction<void>& lock_, const etl::ifunction<void>& unlock_)
|
||||
: m_lock(lock_)
|
||||
, m_unlock(unlock_)
|
||||
{
|
||||
}
|
||||
|
||||
void lock() { m_lock(); }
|
||||
void unlock() { m_unlock(); }
|
||||
|
||||
private:
|
||||
lock_adapter(const lock_adapter&) ETL_DELETE;
|
||||
lock_adapter& operator=(const lock_adapter&) ETL_DELETE;
|
||||
|
||||
const etl::ifunction<void>& m_lock;
|
||||
const etl::ifunction<void>& m_unlock;
|
||||
};
|
||||
|
||||
//*************************************************************************
|
||||
/// Push a value to the queue.
|
||||
//*************************************************************************
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user