3 #include "pico/stdlib.h"
5 #include "pico/util/queue.h"
15 Queue(
int maxCount = 100,
bool blocking=
true,
bool withLock=
true ){
16 is_blocking = blocking;
18 queue_init_with_spinlock(&q,
sizeof(T), maxCount, nextSpinlockNumber());
20 queue_init(&q,
sizeof(T),maxCount);
29 return queue_is_empty(&q);
33 return queue_is_full(&q);
39 queue_peek_blocking(&q, (
void*) &data);
42 result = queue_try_peek(&q, (
void*) &data);
50 queue_add_blocking(&q, (
void*) &data);
53 result = queue_try_add(&q, (
void*) &data);
61 queue_remove_blocking(&q, (
void*) &data);
64 result = queue_try_remove(&q, (
void*) &data);
70 return queue_get_level(&q);
75 while(remove((
void*) &data));
82 uint nextSpinlockNumber(){
83 static uint spinlock_num;
84 return spinlock_num++;
Construct a new Pico Queue object.
Definition: PicoQueue.h:13