48typedef struct __evq evq_t;
62typedef struct __evq evq_id [];
80#define _EVQ_INIT( _limit, _data ) { _OBJ_INIT(), 0, _limit, 0, 0, _data }
98#define _EVQ_DATA( _limit ) (unsigned[_limit]){ 0 }
108#define OS_EVQ_BUFFER( buf, limit ) \
118#define OS_EVQ( evq, limit ) \
119 static unsigned evq##__buf[limit]; \
120 evq_t evq[] = { _EVQ_INIT( limit, evq##__buf ) }
123#define static_EVQ( evq, limit ) \
124 static unsigned evq##__buf[limit]; \
125 static evq_t evq[] = { _EVQ_INIT( limit, evq##__buf ) }
138#define EVQ_INIT( limit ) \
139 _EVQ_INIT( limit, _EVQ_DATA( limit ) )
153#define EVQ_CREATE( limit ) \
154 { EVQ_INIT ( limit ) }
172void evq_init( evq_t *evq,
unsigned *
data,
size_t bufsize );
201int evq_take( evq_t *evq,
unsigned *event );
227int evq_waitFor( evq_t *evq,
unsigned *event, cnt_t delay );
278int evq_give( evq_t *evq,
unsigned event );
300int evq_sendFor( evq_t *evq,
unsigned event, cnt_t delay );
346void evq_push( evq_t *evq,
unsigned event );
384#if defined(__cplusplus)
394template<
unsigned limit_>
406 assert(_src.__evq::count == 0 && _src.obj.queue ==
nullptr);
416 int take (
unsigned *_event =
nullptr ) {
return evq_take (
this, _event); }
424 int wait (
unsigned *_event =
nullptr ) {
return evq_wait (
this, _event); }
426 int give (
unsigned _event ) {
return evq_give (
this, _event); }
446 unsigned data_[limit_];
#define INFINITE
infinite waiting
Definition osbase.h:250
int evq_give(evq_t *evq, unsigned event)
try to transfer event value to the event queue object, don't wait if the event queue object is full
void evq_push(evq_t *evq, unsigned event)
transfer event value to the event queue object, remove the oldest event value if the event queue obje...
void evq_init(evq_t *evq, unsigned *data, size_t bufsize)
initialize an event queue object
int evq_tryWait(evq_t *evq, unsigned *event)
alias of evq_take()
Definition oseventqueue.h:204
int evq_waitUntil(evq_t *evq, unsigned *event, cnt_t time)
try to transfer event value from the event queue object, wait until given timepoint while the event q...
int evq_sendFor(evq_t *evq, unsigned event, cnt_t delay)
try to transfer event value to the event queue object, wait for given duration of time while the even...
void evq_kill(evq_t *evq)
alias of evq_reset()
Definition oseventqueue.h:185
int evq_giveAsync(evq_t *evq, unsigned event)
Async alias of evq_give().
int evq_wait(evq_t *evq, unsigned *event)
try to transfer event value from the event queue object, wait indefinitely while the event queue obje...
Definition oseventqueue.h:257
unsigned evq_space(evq_t *evq)
return the amount of free space in the event queue
int evq_waitFor(evq_t *evq, unsigned *event, cnt_t delay)
try to transfer event value from the event queue object, wait for given duration of time while the ev...
unsigned evq_count(evq_t *evq)
return the amount of data contained in the event queue
void evq_reset(evq_t *evq)
reset the event queue object and wake up all waiting tasks with 'E_STOPPED' event value
int evq_sendAsync(evq_t *evq, unsigned event)
Async alias of evq_send().
int evq_sendUntil(evq_t *evq, unsigned event, cnt_t time)
try to transfer event value to the event queue object, wait until given timepoint while the event que...
int evq_send(evq_t *evq, unsigned event)
try to transfer event value to the event queue object, wait indefinitely while the event queue object...
Definition oseventqueue.h:330
int evq_take(evq_t *evq, unsigned *event)
try to transfer event value from the event queue object, don't wait if the event queue object is empt...
int evq_takeAsync(evq_t *evq, unsigned *event)
Async alias of evq_take().
unsigned evq_limit(evq_t *evq)
return the size of the event queue
int evq_waitAsync(evq_t *evq, unsigned *event)
Async alias of evq_wait().
char data[]
message data
Definition osmessagequeue.h:54
static constexpr rep until(const std::chrono::time_point< Clock, _Duration > &_time)
time point in ticks, rounded up to whole ticks (only a time point of this clock)
Definition osclock.h:109
static constexpr rep count(const std::chrono::duration< _Rep, _Period > &_delay)
delay in ticks, rounded up to whole ticks; negative delay: IMMEDIATE, delay out of range: INFINITE
Definition osclock.h:102
create and initialize an event queue object
Definition oseventqueue.h:395
int waitFor(unsigned *_event, const T &_delay)
evq_waitFor()
Definition oseventqueue.h:420
constexpr EventQueueT()
constructor, see the constructor parameters of the class
Definition oseventqueue.h:398
int waitUntil(unsigned *_event, const T &_time)
evq_waitUntil()
Definition oseventqueue.h:422
int takeAsync(unsigned *_event=nullptr)
evq_takeAsync()
Definition oseventqueue.h:436
int send(unsigned _event)
evq_send()
Definition oseventqueue.h:430
int tryWait(unsigned &_event)
evq_tryWait()
Definition oseventqueue.h:418
int wait(unsigned *_event=nullptr)
evq_wait()
Definition oseventqueue.h:423
void push(unsigned _event)
evq_push()
Definition oseventqueue.h:431
void reset()
evq_reset()
Definition oseventqueue.h:413
void kill()
evq_kill()
Definition oseventqueue.h:414
int wait(unsigned &_event)
evq_wait()
Definition oseventqueue.h:424
unsigned count()
evq_count()
Definition oseventqueue.h:432
int tryWait(unsigned *_event=nullptr)
evq_tryWait()
Definition oseventqueue.h:417
int sendUntil(unsigned _event, const T &_time)
evq_sendUntil()
Definition oseventqueue.h:429
int give(unsigned _event)
evq_give()
Definition oseventqueue.h:425
int giveAsync(unsigned _event)
evq_giveAsync()
Definition oseventqueue.h:440
unsigned space()
evq_space()
Definition oseventqueue.h:433
int takeAsync(unsigned &_event)
evq_takeAsync()
Definition oseventqueue.h:437
int take(unsigned &_event)
evq_take()
Definition oseventqueue.h:416
int sendAsync(unsigned _event)
evq_sendAsync()
Definition oseventqueue.h:441
int take(unsigned *_event=nullptr)
evq_take()
Definition oseventqueue.h:415
int waitAsync(unsigned *_event=nullptr)
evq_waitAsync()
Definition oseventqueue.h:438
unsigned limit()
evq_limit()
Definition oseventqueue.h:434
int waitAsync(unsigned &_event)
evq_waitAsync()
Definition oseventqueue.h:439
int sendFor(unsigned _event, const T &_delay)
evq_sendFor()
Definition oseventqueue.h:427