3 #include "pico/stdlib.h"
5 #include "pico/util/queue.h"
16 Queue(
int maxCount = 100,
bool blocking=
true,
bool withLock=
true ){
17 is_blocking = blocking;
19 queue_init_with_spinlock(&q,
sizeof(T), maxCount, nextSpinlockNumber());
21 queue_init(&q,
sizeof(T),maxCount);
30 return queue_is_empty(&q);
34 return queue_is_full(&q);
40 queue_peek_blocking(&q, (
void*) &data);
43 result = queue_try_peek(&q, (
void*) &data);
51 queue_add_blocking(&q, (
void*) &data);
54 result = queue_try_add(&q, (
void*) &data);
62 queue_remove_blocking(&q, (
void*) &data);
65 result = queue_try_remove(&q, (
void*) &data);
71 return queue_get_level(&q);
76 while(remove((
void*) &data));
83 uint nextSpinlockNumber(){
84 static uint spinlock_num;
85 return spinlock_num++;
Construct a new Pico Queue object.
Definition: PicoQueue.h:14