Embedded Template Library 1.0
Loading...
Searching...
No Matches
queue_spsc_locked.h
Go to the documentation of this file.
1
2
3/******************************************************************************
4The MIT License(MIT)
5
6Embedded Template Library.
7https://github.com/ETLCPP/etl
8https://www.etlcpp.com
9
10Copyright(c) 2019 John Wellbelove
11
12Permission is hereby granted, free of charge, to any person obtaining a copy
13of this software and associated documentation files(the "Software"), to deal
14in the Software without restriction, including without limitation the rights
15to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
16copies of the Software, and to permit persons to whom the Software is
17furnished to do so, subject to the following conditions :
18
19The above copyright notice and this permission notice shall be included in all
20copies or substantial portions of the Software.
21
22THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
25AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28SOFTWARE.
29******************************************************************************/
30
31#ifndef ETL_SPSC_QUEUE_LOCKED_INCLUDED
32#define ETL_SPSC_QUEUE_LOCKED_INCLUDED
33
34#include "platform.h"
35#include "function.h"
36#include "integral_limits.h"
37#include "memory.h"
38#include "memory_model.h"
39#include "parameter_type.h"
40#include "placement_new.h"
41#include "utility.h"
42
43#include <stddef.h>
44
45namespace etl
46{
47 //***************************************************************************
50 //***************************************************************************
51 class queue_spsc_locked_exception : public exception
52 {
53 public:
54
55 queue_spsc_locked_exception(string_type reason_, string_type file_name_, numeric_type line_number_)
56 : exception(reason_, file_name_, line_number_)
57 {
58 }
59 };
60
61 //***************************************************************************
64 //***************************************************************************
65 class queue_spsc_locked_empty : public queue_spsc_locked_exception
66 {
67 public:
68
69 queue_spsc_locked_empty(string_type file_name_, numeric_type line_number_)
70 : queue_spsc_locked_exception(ETL_ERROR_TEXT("queue_spsc_locked:empty", ETL_QUEUE_SPSC_LOCKED_FILE_ID"A"), file_name_, line_number_)
71 {
72 }
73 };
74
75 template <size_t MEMORY_MODEL = etl::memory_model::MEMORY_MODEL_LARGE>
76 class iqueue_spsc_locked_base
77 {
78 public:
79
82
83 //*************************************************************************
85 //*************************************************************************
90
91 //*************************************************************************
93 //*************************************************************************
94 bool full_from_unlocked() const
95 {
96 return full_implementation();
97 }
98
99 //*************************************************************************
101 //*************************************************************************
103 {
104 return size_implementation();
105 }
106
107 //*************************************************************************
109 //*************************************************************************
111 {
112 return empty_implementation();
113 }
114
115 //*************************************************************************
117 //*************************************************************************
119 {
120 return MAX_SIZE;
121 }
122
123 //*************************************************************************
125 //*************************************************************************
127 {
128 return MAX_SIZE;
129 }
130
131 protected:
132
134 : write_index(0)
135 , read_index(0)
136 , current_size(0)
137 , MAX_SIZE(max_size_)
138 {
139 }
140
141 //*************************************************************************
143 //*************************************************************************
145 {
146 ++index;
147
148 if (index == maximum) ETL_UNLIKELY
149 {
150 index = 0;
151 }
152
153 return index;
154 }
155
160
161 protected:
162
163 //*************************************************************************
165 //*************************************************************************
167 {
168 return MAX_SIZE - current_size;
169 }
170
171 //*************************************************************************
173 //*************************************************************************
175 {
176 return (current_size == MAX_SIZE);
177 }
178
179 //*************************************************************************
181 //*************************************************************************
183 {
184 return current_size;
185 }
186
187 //*************************************************************************
189 //*************************************************************************
191 {
192 return (current_size == 0);
193 }
194
195 //*************************************************************************
197 //*************************************************************************
198#if defined(ETL_POLYMORPHIC_SPSC_QUEUE_ISR) || defined(ETL_POLYMORPHIC_CONTAINERS)
199
200 public:
201
202 virtual ~iqueue_spsc_locked_base() {}
203#else
204
205 protected:
206
208#endif
209 };
210
211 //***************************************************************************
219 //***************************************************************************
220 template <typename T, const size_t MEMORY_MODEL = etl::memory_model::MEMORY_MODEL_LARGE>
221 class iqueue_spsc_locked : public iqueue_spsc_locked_base<MEMORY_MODEL>
222 {
223 private:
224
225 typedef iqueue_spsc_locked_base<MEMORY_MODEL> base_t;
226
227 public:
228
229 typedef T value_type;
230 typedef T& reference;
231 typedef const T& const_reference;
232#if ETL_USING_CPP11
233 typedef T&& rvalue_reference;
234#endif
235 typedef typename base_t::size_type size_type;
236
237 //*************************************************************************
239 //*************************************************************************
241 {
242 return push_implementation(value);
243 }
244
245 //*************************************************************************
247 //*************************************************************************
249 {
250 lock();
251
252 bool result = push_implementation(value);
253
254 unlock();
255
256 return result;
257 }
258
259#if ETL_USING_CPP11 && ETL_NOT_USING_STLPORT && !defined(ETL_QUEUE_LOCKED_FORCE_CPP03_IMPLEMENTATION)
260 //*************************************************************************
263 //*************************************************************************
264 bool push_from_unlocked(rvalue_reference value)
265 {
266 return push_implementation(etl::move(value));
267 }
268
269 //*************************************************************************
272 //*************************************************************************
273 bool push(rvalue_reference value)
274 {
275 lock();
276
277 bool result = push_implementation(etl::move(value));
278
279 unlock();
280
281 return result;
282 }
283#endif
284
285#if ETL_USING_CPP11 && ETL_NOT_USING_STLPORT && !defined(ETL_QUEUE_LOCKED_FORCE_CPP03_IMPLEMENTATION)
286 //*************************************************************************
289 //*************************************************************************
290 template <typename... Args>
291 bool emplace_from_unlocked(Args&&... args)
292 {
293 return emplace_implementation(etl::forward<Args>(args)...);
294 }
295
296 //*************************************************************************
299 //*************************************************************************
300 template <typename... Args>
301 bool emplace(Args&&... args)
302 {
303 lock();
304
305 bool result = emplace_implementation(etl::forward<Args>(args)...);
306
307 unlock();
308
309 return result;
310 }
311#else
312 //*************************************************************************
316 //*************************************************************************
317 template <typename T1>
318 bool emplace_from_unlocked(const T1& value1)
319 {
320 return emplace_implementation(value1);
321 }
322
323 //*************************************************************************
327 //*************************************************************************
328 template <typename T1, typename T2>
329 bool emplace_from_unlocked(const T1& value1, const T2& value2)
330 {
331 return emplace_implementation(value1, value2);
332 }
333
334 //*************************************************************************
338 //*************************************************************************
339 template <typename T1, typename T2, typename T3>
340 bool emplace_from_unlocked(const T1& value1, const T2& value2, const T3& value3)
341 {
342 return emplace_implementation(value1, value2, value3);
343 }
344
345 //*************************************************************************
349 //*************************************************************************
350 template <typename T1, typename T2, typename T3, typename T4>
351 bool emplace_from_unlocked(const T1& value1, const T2& value2, const T3& value3, const T4& value4)
352 {
353 return emplace_implementation(value1, value2, value3, value4);
354 }
355
356 //*************************************************************************
360 //*************************************************************************
361 bool emplace()
362 {
363 lock();
364
365 bool result = emplace_implementation();
366
367 unlock();
368
369 return result;
370 }
371
372 //*************************************************************************
376 //*************************************************************************
377 template <typename T1>
378 bool emplace(const T1& value1)
379 {
380 lock();
381
382 bool result = emplace_implementation(value1);
383
384 unlock();
385
386 return result;
387 }
388
389 //*************************************************************************
393 //*************************************************************************
394 template <typename T1, typename T2>
395 bool emplace(const T1& value1, const T2& value2)
396 {
397 lock();
398
399 bool result = emplace_implementation(value1, value2);
400
401 unlock();
402
403 return result;
404 }
405
406 //*************************************************************************
410 //*************************************************************************
411 template <typename T1, typename T2, typename T3>
412 bool emplace(const T1& value1, const T2& value2, const T3& value3)
413 {
414 lock();
415
416 bool result = emplace_implementation(value1, value2, value3);
417
418 unlock();
419
420 return result;
421 }
422
423 //*************************************************************************
427 //*************************************************************************
428 template <typename T1, typename T2, typename T3, typename T4>
429 bool emplace(const T1& value1, const T2& value2, const T3& value3, const T4& value4)
430 {
431 lock();
432
433 bool result = emplace_implementation(value1, value2, value3, value4);
434
435 unlock();
436
437 return result;
438 }
439#endif
440
441 //*************************************************************************
444 //*************************************************************************
446 {
447 return pop_implementation(value);
448 }
449
450 //*************************************************************************
452 //*************************************************************************
453 bool pop(reference value)
454 {
455 lock();
456
457 bool result = pop_implementation(value);
458
459 unlock();
460
461 return result;
462 }
463
464 //*************************************************************************
467 //*************************************************************************
469 {
470 return pop_implementation();
471 }
472
473 //*************************************************************************
475 //*************************************************************************
476 bool pop()
477 {
478 lock();
479
480 bool result = pop_implementation();
481
482 unlock();
483
484 return result;
485 }
486
487 //*************************************************************************
490 //*************************************************************************
492 {
493 return front_implementation();
494 }
495
496 //*************************************************************************
499 //*************************************************************************
501 {
502 return front_implementation();
503 }
504
505 //*************************************************************************
509 //*************************************************************************
511 {
512#if ETL_CHECKING_EXTRA
513 lock();
514 if (!this->empty_from_unlocked())
515 {
516 reference inner_result = front_implementation();
517 unlock();
518 return inner_result;
519 }
520 else
521 {
522 unlock();
523 ETL_ASSERT_FAIL(ETL_ERROR(queue_spsc_locked_empty));
524 // fall through to return something to satisfy the compiler, even
525 // though this should never be reached due to undefined behaviour.
526 }
527#endif
528 lock();
529 reference result = front_implementation();
530 unlock();
531 return result;
532 }
533
534 //*************************************************************************
538 //*************************************************************************
540 {
541#if ETL_CHECKING_EXTRA
542 lock();
543 if (!this->empty_from_unlocked())
544 {
545 const_reference inner_result = front_implementation();
546 unlock();
547 return inner_result;
548 }
549 else
550 {
551 unlock();
552 ETL_ASSERT_FAIL(ETL_ERROR(queue_spsc_locked_empty));
553 // fall through to return something to satisfy the compiler, even
554 // though this should never be reached due to undefined behaviour.
555 }
556#endif
557 lock();
558 const_reference result = front_implementation();
559 unlock();
560 return result;
561 }
562
563 //*************************************************************************
565 //*************************************************************************
567 {
568 while (pop_implementation())
569 {
570 // Do nothing.
571 }
572 }
573
574 //*************************************************************************
576 //*************************************************************************
577 void clear()
578 {
579 lock();
580
581 if ETL_IF_CONSTEXPR (etl::is_trivially_destructible<T>::value)
582 {
583 this->write_index = 0;
584 this->read_index = 0;
585 this->current_size = 0;
586 }
587 else
588 {
589 while (pop_implementation())
590 {
591 // Do nothing.
592 }
593 }
594
595 unlock();
596 }
597
598 //*************************************************************************
600 //*************************************************************************
602 {
603 lock();
604
605 size_type result = this->available_implementation();
606
607 unlock();
608
609 return result;
610 }
611
612 //*************************************************************************
614 //*************************************************************************
615 bool full() const
616 {
617 lock();
618
619 size_type result = this->full_implementation();
620
621 unlock();
622
623 return result;
624 }
625
626 //*************************************************************************
628 //*************************************************************************
630 {
631 lock();
632
633 size_type result = this->size_implementation();
634
635 unlock();
636
637 return result;
638 }
639
640 //*************************************************************************
642 //*************************************************************************
643 bool empty() const
644 {
645 lock();
646
647 bool result = this->empty_implementation();
648
649 unlock();
650
651 return result;
652 }
653
654 protected:
655
656 //*************************************************************************
658 //*************************************************************************
659 iqueue_spsc_locked(T* p_buffer_, size_type max_size_, const etl::ifunction<void>& lock_, const etl::ifunction<void>& unlock_)
660 : base_t(max_size_)
661 , p_buffer(p_buffer_)
662 , lock(lock_)
663 , unlock(unlock_)
664 {
665 }
666
667 private:
668
669 //*************************************************************************
671 //*************************************************************************
672 bool push_implementation(const_reference value)
673 {
674 if (this->current_size != this->MAX_SIZE)
675 {
676 ::new (&p_buffer[this->write_index]) T(value);
677
678 this->write_index = this->get_next_index(this->write_index, this->MAX_SIZE);
679
680 ++this->current_size;
681
682 return true;
683 }
684
685 // Queue is full.
686 return false;
687 }
688
689#if ETL_USING_CPP11 && ETL_NOT_USING_STLPORT && !defined(ETL_QUEUE_LOCKED_FORCE_CPP03_IMPLEMENTATION)
690 //*************************************************************************
693 //*************************************************************************
694 bool push_implementation(rvalue_reference value)
695 {
696 if (this->current_size != this->MAX_SIZE)
697 {
698 ::new (&p_buffer[this->write_index]) T(etl::move(value));
699
700 this->write_index = this->get_next_index(this->write_index, this->MAX_SIZE);
701
702 ++this->current_size;
703
704 return true;
705 }
706
707 // Queue is full.
708 return false;
709 }
710#endif
711
712#if ETL_USING_CPP11 && ETL_NOT_USING_STLPORT && !defined(ETL_QUEUE_LOCKED_FORCE_CPP03_IMPLEMENTATION)
713 //*************************************************************************
716 //*************************************************************************
717 template <typename... Args>
718 bool emplace_implementation(Args&&... args)
719 {
720 if (this->current_size != this->MAX_SIZE)
721 {
722 ::new (&p_buffer[this->write_index]) T(etl::forward<Args>(args)...);
723
724 this->write_index = this->get_next_index(this->write_index, this->MAX_SIZE);
725
726 ++this->current_size;
727
728 return true;
729 }
730
731 // Queue is full.
732 return false;
733 }
734#else
735 //*************************************************************************
737 //*************************************************************************
738 bool emplace_implementation()
739 {
740 if (this->current_size != this->MAX_SIZE)
741 {
742 ::new (&p_buffer[this->write_index]) T();
743
744 this->write_index = this->get_next_index(this->write_index, this->MAX_SIZE);
745
746 ++this->current_size;
747
748 return true;
749 }
750
751 // Queue is full.
752 return false;
753 }
754
755 //*************************************************************************
757 //*************************************************************************
758 template <typename T1>
759 bool emplace_implementation(const T1& value1)
760 {
761 if (this->current_size != this->MAX_SIZE)
762 {
763 ::new (&p_buffer[this->write_index]) T(value1);
764
765 this->write_index = this->get_next_index(this->write_index, this->MAX_SIZE);
766
767 ++this->current_size;
768
769 return true;
770 }
771
772 // Queue is full.
773 return false;
774 }
775
776 //*************************************************************************
778 //*************************************************************************
779 template <typename T1, typename T2>
780 bool emplace_implementation(const T1& value1, const T2& value2)
781 {
782 if (this->current_size != this->MAX_SIZE)
783 {
784 ::new (&p_buffer[this->write_index]) T(value1, value2);
785
786 this->write_index = this->get_next_index(this->write_index, this->MAX_SIZE);
787
788 ++this->current_size;
789
790 return true;
791 }
792
793 // Queue is full.
794 return false;
795 }
796
797 //*************************************************************************
799 //*************************************************************************
800 template <typename T1, typename T2, typename T3>
801 bool emplace_implementation(const T1& value1, const T2& value2, const T3& value3)
802 {
803 if (this->current_size != this->MAX_SIZE)
804 {
805 ::new (&p_buffer[this->write_index]) T(value1, value2, value3);
806
807 this->write_index = this->get_next_index(this->write_index, this->MAX_SIZE);
808
809 ++this->current_size;
810
811 return true;
812 }
813
814 // Queue is full.
815 return false;
816 }
817
818 //*************************************************************************
820 //*************************************************************************
821 template <typename T1, typename T2, typename T3, typename T4>
822 bool emplace_implementation(const T1& value1, const T2& value2, const T3& value3, const T4& value4)
823 {
824 if (this->current_size != this->MAX_SIZE)
825 {
826 ::new (&p_buffer[this->write_index]) T(value1, value2, value3, value4);
827
828 this->write_index = this->get_next_index(this->write_index, this->MAX_SIZE);
829
830 ++this->current_size;
831
832 return true;
833 }
834
835 // Queue is full.
836 return false;
837 }
838#endif
839
840 //*************************************************************************
843 //*************************************************************************
844 bool pop_implementation(reference value)
845 {
846 if (this->current_size == 0)
847 {
848 // Queue is empty
849 return false;
850 }
851
852#if ETL_USING_CPP11 && ETL_NOT_USING_STLPORT && !defined(ETL_QUEUE_LOCKABLE_FORCE_CPP03_IMPLEMENTATION)
853 value = etl::move(p_buffer[this->read_index]);
854#else
855 value = p_buffer[this->read_index];
856#endif
857
858 p_buffer[this->read_index].~T();
859
860 this->read_index = this->get_next_index(this->read_index, this->MAX_SIZE);
861
862 --this->current_size;
863
864 return true;
865 }
866
867 //*************************************************************************
870 //*************************************************************************
871 reference front_implementation()
872 {
873 return p_buffer[this->read_index];
874 }
875
876 //*************************************************************************
879 //*************************************************************************
880 const_reference front_implementation() const
881 {
882 return p_buffer[this->read_index];
883 }
884
885 //*************************************************************************
888 //*************************************************************************
889 bool pop_implementation()
890 {
891 if (this->current_size == 0)
892 {
893 // Queue is empty
894 return false;
895 }
896
897 p_buffer[this->read_index].~T();
898
899 this->read_index = this->get_next_index(this->read_index, this->MAX_SIZE);
900
901 --this->current_size;
902
903 return true;
904 }
905
906 // Disable copy construction and assignment.
907 iqueue_spsc_locked(const iqueue_spsc_locked&) ETL_DELETE;
908 iqueue_spsc_locked& operator=(const iqueue_spsc_locked&) ETL_DELETE;
909
910#if ETL_USING_CPP11
912 iqueue_spsc_locked& operator=(iqueue_spsc_locked&&) = delete;
913#endif
914
915 T* p_buffer;
916
917 const etl::ifunction<void>& lock;
918 const etl::ifunction<void>& unlock;
919 };
920
921 //***************************************************************************
930 //***************************************************************************
931 template <typename T, size_t SIZE, const size_t MEMORY_MODEL = etl::memory_model::MEMORY_MODEL_LARGE>
932 class queue_spsc_locked : public etl::iqueue_spsc_locked<T, MEMORY_MODEL>
933 {
934 private:
935
937
938 public:
939
940 typedef typename base_t::size_type size_type;
941
942 ETL_STATIC_ASSERT((SIZE <= etl::integral_limits<size_type>::max), "Size too large for memory model");
943
944 static ETL_CONSTANT size_type MAX_SIZE = size_type(SIZE);
945
946 //*************************************************************************
948 //*************************************************************************
949
951 : base_t(reinterpret_cast<T*>(buffer.raw), MAX_SIZE, lock_, unlock_)
952 {
953 }
954
955 //*************************************************************************
957 //*************************************************************************
959 {
961 }
962
963 private:
964
965 queue_spsc_locked(const queue_spsc_locked&) ETL_DELETE;
966 queue_spsc_locked& operator=(const queue_spsc_locked&) ETL_DELETE;
967
968#if ETL_USING_CPP11
970 queue_spsc_locked& operator=(queue_spsc_locked&&) = delete;
971#endif
972
975 };
976
977 template <typename T, size_t SIZE, const size_t MEMORY_MODEL>
979} // namespace etl
980
981#endif
Definition queue_spsc_locked.h:77
size_type available_from_unlocked() const
How much free space available in the queue.
Definition queue_spsc_locked.h:86
const size_type MAX_SIZE
Definition queue_spsc_locked.h:159
bool empty_implementation() const
Is the queue empty?
Definition queue_spsc_locked.h:190
size_type available_implementation() const
How much free space available in the queue.
Definition queue_spsc_locked.h:166
bool full_from_unlocked() const
Is the queue full?
Definition queue_spsc_locked.h:94
bool empty_from_unlocked() const
Is the queue empty?
Definition queue_spsc_locked.h:110
size_type max_size() const
How many items can the queue hold.
Definition queue_spsc_locked.h:126
size_type size_from_unlocked() const
How many items in the queue?
Definition queue_spsc_locked.h:102
size_type current_size
The current size of the queue.
Definition queue_spsc_locked.h:158
size_type write_index
Where to input new data.
Definition queue_spsc_locked.h:156
bool full_implementation() const
Is the queue full?
Definition queue_spsc_locked.h:174
etl::size_type_lookup< MEMORY_MODEL >::type size_type
The type used for determining the size of queue.
Definition queue_spsc_locked.h:81
size_type capacity() const
How many items can the queue hold.
Definition queue_spsc_locked.h:118
~iqueue_spsc_locked_base()
Destructor.
Definition queue_spsc_locked.h:207
static size_type get_next_index(size_type index, size_type maximum)
Calculate the next index.
Definition queue_spsc_locked.h:144
size_type read_index
Where to get the oldest data.
Definition queue_spsc_locked.h:157
size_type size_implementation() const
How many items in the queue?
Definition queue_spsc_locked.h:182
This is the base for all queue_spsc_locked that contain a particular type.
Definition queue_spsc_locked.h:222
bool emplace(const T1 &value1, const T2 &value2, const T3 &value3, const T4 &value4)
Definition queue_spsc_locked.h:429
bool emplace(const T1 &value1)
Definition queue_spsc_locked.h:378
bool pop_from_unlocked()
Definition queue_spsc_locked.h:468
bool emplace_from_unlocked(const T1 &value1)
Definition queue_spsc_locked.h:318
reference front_from_unlocked()
Definition queue_spsc_locked.h:491
bool emplace(const T1 &value1, const T2 &value2, const T3 &value3)
Definition queue_spsc_locked.h:412
bool emplace(const T1 &value1, const T2 &value2)
Definition queue_spsc_locked.h:395
bool emplace_from_unlocked(const T1 &value1, const T2 &value2)
Definition queue_spsc_locked.h:329
iqueue_spsc_locked(T *p_buffer_, size_type max_size_, const etl::ifunction< void > &lock_, const etl::ifunction< void > &unlock_)
The constructor that is called from derived classes.
Definition queue_spsc_locked.h:659
T & reference
A reference to the type used in the queue.
Definition queue_spsc_locked.h:230
bool pop()
Pop a value from the queue and discard.
Definition queue_spsc_locked.h:476
bool pop(reference value)
Pop a value from the queue.
Definition queue_spsc_locked.h:453
void clear()
Clear the queue.
Definition queue_spsc_locked.h:577
bool emplace_from_unlocked(const T1 &value1, const T2 &value2, const T3 &value3)
Definition queue_spsc_locked.h:340
reference front()
Definition queue_spsc_locked.h:510
T value_type
The type stored in the queue.
Definition queue_spsc_locked.h:229
const T & const_reference
A const reference to the type used in the queue.
Definition queue_spsc_locked.h:231
const_reference front_from_unlocked() const
Definition queue_spsc_locked.h:500
bool empty() const
Is the queue empty?
Definition queue_spsc_locked.h:643
size_type size() const
How many items in the queue?
Definition queue_spsc_locked.h:629
bool push_from_unlocked(const_reference value)
Push a value to the queue.
Definition queue_spsc_locked.h:240
bool emplace()
Definition queue_spsc_locked.h:361
base_t::size_type size_type
The type used for determining the size of the queue.
Definition queue_spsc_locked.h:235
bool emplace_from_unlocked(const T1 &value1, const T2 &value2, const T3 &value3, const T4 &value4)
Definition queue_spsc_locked.h:351
const_reference front() const
Definition queue_spsc_locked.h:539
bool full() const
Is the queue full?
Definition queue_spsc_locked.h:615
void clear_from_unlocked()
Clear the queue from the ISR.
Definition queue_spsc_locked.h:566
bool push(const_reference value)
Push a value to the queue.
Definition queue_spsc_locked.h:248
size_type available() const
How much free space available in the queue.
Definition queue_spsc_locked.h:601
bool pop_from_unlocked(reference value)
Definition queue_spsc_locked.h:445
Definition queue_spsc_locked.h:933
queue_spsc_locked(const etl::ifunction< void > &lock_, const etl::ifunction< void > &unlock_)
Default constructor.
Definition queue_spsc_locked.h:950
~queue_spsc_locked()
Destructor.
Definition queue_spsc_locked.h:958
Definition memory.h:3153
ETL_EXCEPTION_CONSTEXPR exception(string_type reason_, string_type, numeric_type)
Constructor.
Definition exception.h:81
Definition function.h:54
Definition integral_limits.h:517
Definition queue_spsc_locked.h:66
Definition absolute.h:40
Definition memory_model.h:50